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: openai origin credential not start with { (#1874)

takatostae975b10e940
diff --git a/api/core/provider_manager.py b/api/core/provider_manager.py
index 4572ff7507f..82c149673c5 100644
--- a/api/core/provider_manager.py
+++ b/api/core/provider_manager.py
@@ -446,7 +446,14 @@ class ProviderManager:
custom_provider_configuration = None
if custom_provider_record:
try:
- provider_credentials = json.loads(custom_provider_record.encrypted_config)
+ # fix origin data
+ if (custom_provider_record.encrypted_config
+ and not custom_provider_record.encrypted_config.startswith("{")):
+ provider_credentials = {
+ "openai_api_key": custom_provider_record.encrypted_config
+ }
+ else:
+ provider_credentials = json.loads(custom_provider_record.encrypted_config)
except JSONDecodeError:
provider_credentials = {}