优化: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

View File

@@ -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)

View File

@@ -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 = '<span style="font-size:14px; margin-right:3px;">🤖</span>' +
'<span class="user-name" style="color: #16a34a; font-weight: bold;">AI小助手</span>';
botDiv.innerHTML = `
<img class="user-head" src="/images/headface/1.GIF" onerror="this.src='/images/headface/1.GIF'">
<span class="user-name">AI小助手</span><span style="font-size:12px; margin-left:2px;" title="聊天机器人">🤖</span>
`;
botDiv.onclick = () => {
toUserSelect.value = 'AI小助手';
document.getElementById('content').focus();