优化:AI小助手在线列表样式改为与普通用户一致

This commit is contained in:
2026-02-26 21:46:25 +08:00
parent fd3214eaff
commit 5d722bbb0b
2 changed files with 10 additions and 6 deletions
+5 -1
View File
@@ -133,7 +133,11 @@ PROMPT;
{ {
$startTime = microtime(true); $startTime = microtime(true);
$apiKey = $config->getDecryptedApiKey(); $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 { try {
$response = Http::withToken($apiKey) $response = Http::withToken($apiKey)
@@ -84,14 +84,14 @@
}; };
userList.appendChild(allDiv); userList.appendChild(allDiv);
// ── AI 小助手(仅当全局开关开启时显示)── // ── AI 小助手(仅当全局开关开启时显示,与普通用户风格一致)──
if (window.chatContext.chatBotEnabled) { if (window.chatContext.chatBotEnabled) {
let botDiv = document.createElement('div'); let botDiv = document.createElement('div');
botDiv.className = 'user-item'; botDiv.className = 'user-item';
botDiv.style.background = 'linear-gradient(135deg, #e0f2fe, #f0fdf4)'; botDiv.innerHTML = `
botDiv.style.borderLeft = '3px solid #22c55e'; <img class="user-head" src="/images/headface/1.GIF" onerror="this.src='/images/headface/1.GIF'">
botDiv.innerHTML = '<span style="font-size:14px; margin-right:3px;">🤖</span>' + <span class="user-name">AI小助手</span><span style="font-size:12px; margin-left:2px;" title="聊天机器人">🤖</span>
'<span class="user-name" style="color: #16a34a; font-weight: bold;">AI小助手</span>'; `;
botDiv.onclick = () => { botDiv.onclick = () => {
toUserSelect.value = 'AI小助手'; toUserSelect.value = 'AI小助手';
document.getElementById('content').focus(); document.getElementById('content').focus();