BugFix: Fixed api_key generation error for VolcEngine (#2502)

BugFix: Fixed api_key generation error for VolcEngine with python's
f-string syntax

### What problem does this PR solve?

_Briefly describe what this PR aims to solve. Include background context
that will help reviewers understand the purpose of the PR._

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: 海贼宅 <stu_xyx@163.com>
This commit is contained in:
yungongzi 2024-09-20 10:03:43 +08:00 committed by GitHub
parent ddb8be9219
commit 4f962d6bff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -130,8 +130,7 @@ def add_llm():
# For VolcEngine, due to its special authentication method
# Assemble ark_api_key endpoint_id into api_key
llm_name = req["llm_name"]
api_key = '{' + f'"ark_api_key": "{req.get("ark_api_key", "")}", ' \
f'"ep_id": "{req.get("endpoint_id", "")}" ' + '}'
api_key = f'{{ "ark_api_key":"{req.get("ark_api_key", "")}", "ep_id":"{req.get("endpoint_id", "")}" }}'
elif factory == "Tencent Hunyuan":
api_key = '{' + f'"hunyuan_sid": "{req.get("hunyuan_sid", "")}", ' \
f'"hunyuan_sk": "{req.get("hunyuan_sk", "")}"' + '}'