mirror of
https://github.com/suitenumerique/docs.git
synced 2026-09-18 07:37:56 +02:00
♻️(backend) use mistral sdk with legacy ai feature
We also want to use the mistral sdk with the legacy AI feature when this one is configured with the settings. In order to separate bot feature, they now live in their own module.
This commit is contained in:
@@ -14,7 +14,7 @@ import pytest
|
||||
from rest_framework.test import APIClient
|
||||
|
||||
from core import factories, models
|
||||
from core.services.ai_services import configure_legacy_openai_client
|
||||
from core.services.ai_services.legacy import get_legacy_ai_service
|
||||
from core.tests.documents.test_api_documents_ai_proxy import ( # pylint: disable=unused-import
|
||||
ai_settings,
|
||||
)
|
||||
@@ -27,8 +27,7 @@ pytestmark = pytest.mark.django_db
|
||||
@pytest.fixture(autouse=True)
|
||||
def clear_openai_client_config():
|
||||
"""Clear the configure_legacy_openai_client cache."""
|
||||
yield
|
||||
configure_legacy_openai_client.cache_clear()
|
||||
get_legacy_ai_service.cache_clear()
|
||||
|
||||
|
||||
def test_external_api_documents_ai_transform_not_allowed(
|
||||
@@ -249,7 +248,7 @@ def test_external_api_documents_ai_translate_can_be_allowed(
|
||||
}
|
||||
)
|
||||
@pytest.mark.usefixtures("ai_settings")
|
||||
@patch("core.services.ai_services.AIService.stream")
|
||||
@patch("core.services.ai_services.blocknote.AIService.stream")
|
||||
def test_external_api_documents_ai_proxy_can_be_allowed(
|
||||
mock_stream, user_token, resource_server_backend, user_specific_sub
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user