From 4f962d6bffe00955fba77a5652c6c0603161f05c Mon Sep 17 00:00:00 2001 From: yungongzi Date: Fri, 20 Sep 2024 10:03:43 +0800 Subject: [PATCH] BugFix: Fixed api_key generation error for VolcEngine (#2502) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: 海贼宅 --- api/apps/llm_app.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/apps/llm_app.py b/api/apps/llm_app.py index 19fbbece..d7a852b0 100644 --- a/api/apps/llm_app.py +++ b/api/apps/llm_app.py @@ -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", "")}"' + '}'