From d4b1f3dfffc32b69112747ad8ae19c227e906868 Mon Sep 17 00:00:00 2001 From: hubian <908234780@qq.com> Date: Wed, 29 Apr 2026 00:30:47 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=87=AA=E5=8A=A8=E6=8B=BC=E6=8E=A5/cha?= =?UTF-8?q?t/completions=E5=88=B0API=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/app.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/www/app.js b/www/app.js index 4ec0663..0b3154c 100644 --- a/www/app.js +++ b/www/app.js @@ -140,7 +140,13 @@ async function loadBackendConfig() { // 将后台 LLM 配置赋值到 CONFIG if (backendConfig.llm) { - CONFIG.apiUrl = backendConfig.llm.api_url; + // 自动拼接 /chat/completions(如果不是完整URL) + let apiUrl = backendConfig.llm.api_url; + if (apiUrl && !apiUrl.includes('/chat/completions')) { + // 确保URL以/结尾再拼接,或直接拼接 + apiUrl = apiUrl.endsWith('/') ? apiUrl + 'chat/completions' : apiUrl + '/chat/completions'; + } + CONFIG.apiUrl = apiUrl; CONFIG.apiKey = backendConfig.llm.api_key; CONFIG.model = backendConfig.llm.model; CONFIG.maxTokens = backendConfig.llm.max_tokens || 2048;