UPDATE: API URL 处理,使用Cherry Studio相同逻辑处理

This commit is contained in:
兰志宏
2025-03-04 16:30:23 +08:00
parent 0558cb34e9
commit aada813de8

View File

@@ -259,15 +259,12 @@ class StockAnalyzer:
logger.error(error_msg)
return error_msg if not stream else (yield json.dumps({"error": error_msg}))
# 标准化API URL
api_url = self.API_URL
if not (api_url.endswith('/chat/completions') or api_url.endswith('/v1/chat/completions')):
if api_url.endswith('/v1'):
api_url = f"{api_url}/chat/completions"
elif api_url.endswith('/'):
api_url = f"{api_url}v1/chat/completions"
# 标准化API URL 使用Cherry Studio相同逻辑处理
if self.API_URL.endswith('/'):
api_url = f"{self.API_URL}chat/completions"
else:
api_url = f"{api_url}/v1/chat/completions"
api_url = f"{self.API_URL}/v1/chat/completions"
logger.debug(f"标准化后的API URL: {api_url}")