Fix openai api key, config settings saving

This commit is contained in:
shamoon
2025-04-25 21:34:14 -07:00
parent 0052f21cea
commit 0690fd36c5
4 changed files with 8 additions and 3 deletions

View File

@@ -203,6 +203,11 @@ class ApplicationConfigurationSerializer(serializers.ModelSerializer):
data["barcode_tag_mapping"] = None
if "language" in data and data["language"] == "":
data["language"] = None
if "llm_api_key" in data and data["llm_api_key"] is not None:
if data["llm_api_key"] == "":
data["llm_api_key"] = None
elif len(data["llm_api_key"].replace("*", "")) == 0:
del data["llm_api_key"]
return super().run_validation(data)
def update(self, instance, validated_data):