Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: credentials validate compatible problem (#2170)

takatost784da52ea6ff
diff --git a/api/core/entities/provider_configuration.py b/api/core/entities/provider_configuration.py
index e99b238963e..a7a365fe69a 100644
--- a/api/core/entities/provider_configuration.py
+++ b/api/core/entities/provider_configuration.py
@@ -153,8 +153,16 @@ class ProviderConfiguration(BaseModel):
if provider_record:
try:
- original_credentials = json.loads(
- provider_record.encrypted_config) if provider_record.encrypted_config else {}
+ # fix origin data
+ if provider_record.encrypted_config:
+ if not provider_record.encrypted_config.startswith("{"):
+ original_credentials = {
+ "openai_api_key": provider_record.encrypted_config
+ }
+ else:
+ original_credentials = json.loads(provider_record.encrypted_config)
+ else:
+ original_credentials = {}
except JSONDecodeError:
original_credentials = {}