Browse Source

fix: openai origin credential not start with { (#1874)

tags/0.4.2
takatost 1 year ago
parent
commit
ae975b10e9
No account linked to committer's email address
1 changed files with 8 additions and 1 deletions
  1. 8
    1
      api/core/provider_manager.py

+ 8
- 1
api/core/provider_manager.py View File

@@ -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…
Cancel
Save