From 5d722bbb0b928180d94575da0a1aab60de04281e Mon Sep 17 00:00:00 2001 From: lkddi Date: Thu, 26 Feb 2026 21:46:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9AAI=E5=B0=8F=E5=8A=A9?= =?UTF-8?q?=E6=89=8B=E5=9C=A8=E7=BA=BF=E5=88=97=E8=A1=A8=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=B8=8E=E6=99=AE=E9=80=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/AiChatService.php | 6 +++++- resources/views/chat/partials/scripts.blade.php | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/Services/AiChatService.php b/app/Services/AiChatService.php index 59909b1..0c12c64 100644 --- a/app/Services/AiChatService.php +++ b/app/Services/AiChatService.php @@ -133,7 +133,11 @@ PROMPT; { $startTime = microtime(true); $apiKey = $config->getDecryptedApiKey(); - $endpoint = rtrim($config->api_endpoint, '/').'/v1/chat/completions'; + // 智能拼接 URL:如果端点已包含 /v1,则只追加 /chat/completions + $base = rtrim($config->api_endpoint, '/'); + $endpoint = str_ends_with($base, '/v1') + ? $base.'/chat/completions' + : $base.'/v1/chat/completions'; try { $response = Http::withToken($apiKey) diff --git a/resources/views/chat/partials/scripts.blade.php b/resources/views/chat/partials/scripts.blade.php index 1ddf064..4bcf3bc 100644 --- a/resources/views/chat/partials/scripts.blade.php +++ b/resources/views/chat/partials/scripts.blade.php @@ -84,14 +84,14 @@ }; userList.appendChild(allDiv); - // ── AI 小助手(仅当全局开关开启时显示)── + // ── AI 小助手(仅当全局开关开启时显示,与普通用户风格一致)── if (window.chatContext.chatBotEnabled) { let botDiv = document.createElement('div'); botDiv.className = 'user-item'; - botDiv.style.background = 'linear-gradient(135deg, #e0f2fe, #f0fdf4)'; - botDiv.style.borderLeft = '3px solid #22c55e'; - botDiv.innerHTML = '🤖' + - 'AI小助手'; + botDiv.innerHTML = ` + + AI小助手🤖 + `; botDiv.onclick = () => { toUserSelect.value = 'AI小助手'; document.getElementById('content').focus();