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();