mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 11:42:29 +08:00
fix: openai origin credential not start with { (#1874)
This commit is contained in:
parent
b43f1441a9
commit
ae975b10e9
|
@ -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 = {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user