From a569b0574dd8df936c2017192a76104d8b2fa82d Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun, 14 Sep 2025 16:30:30 -0700 Subject: [PATCH] Revert "Sonar code smell sure" This reverts commit 4318f7dac39afeb5c80188d1e64ff0134a420f96. --- .../0005_applicationconfiguration_ai_enabled_and_more.py | 6 ++++++ src/paperless/models.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/paperless/migrations/0005_applicationconfiguration_ai_enabled_and_more.py b/src/paperless/migrations/0005_applicationconfiguration_ai_enabled_and_more.py index 0776091da..a0d46fc81 100644 --- a/src/paperless/migrations/0005_applicationconfiguration_ai_enabled_and_more.py +++ b/src/paperless/migrations/0005_applicationconfiguration_ai_enabled_and_more.py @@ -25,6 +25,7 @@ class Migration(migrations.Migration): field=models.CharField( blank=True, max_length=128, + null=True, verbose_name="Sets the LLM API key", ), ), @@ -35,6 +36,7 @@ class Migration(migrations.Migration): blank=True, choices=[("openai", "OpenAI"), ("ollama", "Ollama")], max_length=32, + null=True, verbose_name="Sets the LLM backend", ), ), @@ -45,6 +47,7 @@ class Migration(migrations.Migration): blank=True, choices=[("openai", "OpenAI"), ("huggingface", "Huggingface")], max_length=32, + null=True, verbose_name="Sets the LLM embedding backend", ), ), @@ -54,6 +57,7 @@ class Migration(migrations.Migration): field=models.CharField( blank=True, max_length=32, + null=True, verbose_name="Sets the LLM embedding model", ), ), @@ -63,6 +67,7 @@ class Migration(migrations.Migration): field=models.CharField( blank=True, max_length=32, + null=True, verbose_name="Sets the LLM model", ), ), @@ -72,6 +77,7 @@ class Migration(migrations.Migration): field=models.CharField( blank=True, max_length=128, + null=True, verbose_name="Sets the LLM endpoint, optional", ), ), diff --git a/src/paperless/models.py b/src/paperless/models.py index e77e73bcc..61cb5f595 100644 --- a/src/paperless/models.py +++ b/src/paperless/models.py @@ -291,6 +291,7 @@ class ApplicationConfiguration(AbstractSingletonModel): llm_embedding_backend = models.CharField( verbose_name=_("Sets the LLM embedding backend"), + null=True, blank=True, max_length=32, choices=LLMEmbeddingBackend.choices, @@ -298,12 +299,14 @@ class ApplicationConfiguration(AbstractSingletonModel): llm_embedding_model = models.CharField( verbose_name=_("Sets the LLM embedding model"), + null=True, blank=True, max_length=32, ) llm_backend = models.CharField( verbose_name=_("Sets the LLM backend"), + null=True, blank=True, max_length=32, choices=LLMBackend.choices, @@ -311,18 +314,21 @@ class ApplicationConfiguration(AbstractSingletonModel): llm_model = models.CharField( verbose_name=_("Sets the LLM model"), + null=True, blank=True, max_length=32, ) llm_api_key = models.CharField( verbose_name=_("Sets the LLM API key"), + null=True, blank=True, max_length=128, ) llm_endpoint = models.CharField( verbose_name=_("Sets the LLM endpoint, optional"), + null=True, blank=True, max_length=128, )