mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-05-27 08:55:25 +00:00
Enhancement (dev): Use OpenAI-like backend (#12668)
This commit is contained in:
@@ -848,7 +848,7 @@ class TestApiAppConfig(DirectoriesMixin, APITestCase):
|
||||
json.dumps(
|
||||
{
|
||||
"ai_enabled": True,
|
||||
"llm_embedding_backend": "openai",
|
||||
"llm_embedding_backend": "openai-like",
|
||||
},
|
||||
),
|
||||
content_type="application/json",
|
||||
|
||||
@@ -404,7 +404,7 @@ class TestSystemStatus(APITestCase):
|
||||
THEN:
|
||||
- The response contains the correct AI status
|
||||
"""
|
||||
with override_settings(AI_ENABLED=True, LLM_EMBEDDING_BACKEND="openai"):
|
||||
with override_settings(AI_ENABLED=True, LLM_EMBEDDING_BACKEND="openai-like"):
|
||||
self.client.force_login(self.user)
|
||||
|
||||
# No tasks found
|
||||
@@ -431,7 +431,7 @@ class TestSystemStatus(APITestCase):
|
||||
THEN:
|
||||
- The response contains the correct AI status
|
||||
"""
|
||||
with override_settings(AI_ENABLED=True, LLM_EMBEDDING_BACKEND="openai"):
|
||||
with override_settings(AI_ENABLED=True, LLM_EMBEDDING_BACKEND="openai-like"):
|
||||
PaperlessTaskFactory(
|
||||
task_type=PaperlessTask.TaskType.LLM_INDEX,
|
||||
trigger_source=PaperlessTask.TriggerSource.SCHEDULED,
|
||||
|
||||
@@ -359,7 +359,7 @@ class TestAISuggestions(DirectoriesMixin, TestCase):
|
||||
@patch("documents.views.get_ai_document_classification")
|
||||
@override_settings(
|
||||
AI_ENABLED=True,
|
||||
LLM_BACKEND="openai",
|
||||
LLM_BACKEND="openai-like",
|
||||
)
|
||||
def test_suggestions_with_invalid_ai_configuration(
|
||||
self,
|
||||
@@ -379,7 +379,9 @@ class TestAISuggestions(DirectoriesMixin, TestCase):
|
||||
"ai": ["Invalid AI configuration."],
|
||||
},
|
||||
)
|
||||
self.assertIsNone(get_llm_suggestion_cache(self.document.pk, backend="openai"))
|
||||
self.assertIsNone(
|
||||
get_llm_suggestion_cache(self.document.pk, backend="openai-like"),
|
||||
)
|
||||
|
||||
def test_invalidate_suggestions_cache(self) -> None:
|
||||
self.client.force_login(user=self.user)
|
||||
|
||||
Reference in New Issue
Block a user