fix: 统一前后端API_URL处理规则: /结尾忽略v1版本,#结尾强制使用输入地址。 优化公告区域位置

This commit is contained in:
兰志宏
2025-03-04 18:24:37 +08:00
parent 661741e25d
commit 0847e557fb
6 changed files with 282 additions and 42 deletions

View File

@@ -3,6 +3,7 @@ import requests
import json
from logger import get_logger, get_stream_logger
from dotenv import load_dotenv
from utils.api_utils import APIUtils
# 获取日志器
logger = get_logger()
@@ -50,11 +51,8 @@ def test_api_stream():
logger.error("API Key未配置无法进行测试")
return
if api_url.endswith('/'):
api_url = f"{api_url}chat/completions"
else:
api_url = f"{api_url}/v1/chat/completions"
# 标准化API URL
api_url = APIUtils.format_api_url(api_url)
logger.debug(f"标准化后的API URL: {api_url}")
# 构建简单的测试提示