v1.0.2修复优化

This commit is contained in:
2026-05-06 16:45:43 +08:00
parent 4acdf6c38b
commit b46de0328c
8 changed files with 120 additions and 41 deletions

View File

@@ -87,27 +87,27 @@ class Installer
[
'name' => '智能助手',
'prompt' => '你是一个全能的智能助手,善于回答各种问题,提供准确、有帮助的回答。',
'icon' => '🤖',
'icon' => 'A',
],
[
'name' => '代码专家',
'prompt' => '你是一个专业的编程专家,精通多种编程语言和技术框架,擅长代码编写、调试和优化。',
'icon' => '💻',
'icon' => '</>',
],
[
'name' => '翻译官',
'prompt' => '你是一个专业的翻译官,精通中文、英文、日文等多种语言,提供准确、流畅的翻译服务。',
'icon' => '🌐',
'icon' => 'T',
],
[
'name' => '写作助手',
'prompt' => '你是一个专业的写作助手,擅长各类文体的写作,包括文章、报告、邮件、创意写作等。',
'icon' => '✍️',
'icon' => 'W',
],
[
'name' => '数学家',
'prompt' => '你是一个数学专家,精通各领域的数学知识,善于解答数学问题并提供详细的解题步骤。',
'icon' => '🔢',
'icon' => 'M',
],
];

View File

@@ -13,7 +13,9 @@
<div class="chat-main">
<!-- 顶部工具栏 -->
<div class="toolbar">
<button class="toggle-sidebar" onclick="toggleSidebar()" title="切换侧边栏"></button>
<button class="toggle-sidebar" onclick="toggleSidebar()" title="切换侧边栏">
<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><path d="M3 6h18M3 12h18M3 18h18"/></svg>
</button>
<select id="providerSelect" onchange="onProviderChange()">
<option value="">选择供应商</option>
@@ -36,7 +38,10 @@
<!-- loadPersonalities() 动态填充 -->
</select>
<a href="/config.php" class="btn btn-secondary btn-sm" style="margin-left:auto;">⚙️ 设置</a>
<a href="/config.php" class="btn btn-secondary btn-sm" style="margin-left:auto;">
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px;"><circle cx="12" cy="12" r="3"/><path d="M12 1v2M12 21v2M4.22 4.22l1.42 1.42M18.36 18.36l1.42 1.42M1 12h2M21 12h2M4.22 19.78l1.42-1.42M18.36 5.64l1.42-1.42"/></svg>
设置
</a>
</div>
<!-- 消息列表 -->
@@ -51,7 +56,9 @@
<div class="input-area">
<div class="file-preview" id="filePreview"></div>
<div class="input-wrapper">
<button id="uploadBtn" title="上传文件" style="background:none;border:none;color:var(--text-secondary);cursor:pointer;font-size:18px;">📎</button>
<button id="uploadBtn" title="上传文件" style="background:none;border:none;color:var(--text-secondary);cursor:pointer;padding:4px;">
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21.44 11.05l-9.19 9.19a6 6 0 01-8.49-8.49l9.19-9.19a4 4 0 015.66 5.66l-9.2 9.19a2 2 0 01-2.83-2.83l8.49-8.48"/></svg>
</button>
<textarea id="messageInput" rows="1" placeholder="输入消息Ctrl+Enter 发送..."></textarea>
<button id="sendBtn">发送</button>
</div>
@@ -129,7 +136,7 @@ async function loadPersonalities() {
personalitiesData.forEach(p => {
const option = document.createElement('option');
option.value = p.id;
option.textContent = (p.icon || '🤖') + ' ' + p.name;
option.textContent = (p.icon ? p.icon + ' ' : '') + p.name;
select.appendChild(option);
});
} catch (err) {

View File

@@ -1,7 +1,13 @@
<div class="config-container">
<div class="config-header">
<h1>⚙️ 系统配置</h1>
<a href="/chat.php" class="btn btn-secondary"> 返回聊天</a>
<h1>
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-4px;margin-right:8px;"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.65 1.65 0 00.33 1.82l.06.06a2 2 0 010 2.83 2 2 0 01-2.83 0l-.06-.06a1.65 1.65 0 00-1.82-.33 1.65 1.65 0 00-1 1.51V21a2 2 0 01-4 0v-.09A1.65 1.65 0 009 19.4a1.65 1.65 0 00-1.82.33l-.06.06a2 2 0 01-2.83-2.83l.06-.06A1.65 1.65 0 004.68 15a1.65 1.65 0 00-1.51-1H3a2 2 0 010-4h.09A1.65 1.65 0 004.6 9a1.65 1.65 0 00-.33-1.82l-.06-.06a2 2 0 012.83-2.83l.06.06A1.65 1.65 0 009 4.68a1.65 1.65 0 001-1.51V3a2 2 0 014 0v.09a1.65 1.65 0 001 1.51 1.65 1.65 0 001.82-.33l.06-.06a2 2 0 012.83 2.83l-.06.06A1.65 1.65 0 0019.4 9a1.65 1.65 0 001.51 1H21a2 2 0 010 4h-.09a1.65 1.65 0 00-1.51 1z"/></svg>
系统配置
</h1>
<a href="/chat.php" class="btn btn-secondary">
<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-2px;margin-right:4px;"><path d="M19 12H5M12 19l-7-7 7-7"/></svg>
返回聊天
</a>
</div>
<!-- 供应商管理 -->
@@ -25,8 +31,8 @@
<input type="text" id="newPersonalityName" placeholder="人格名称">
</div>
<div class="form-group">
<label>图标Emoji</label>
<input type="text" id="newPersonalityIcon" placeholder="如:🤖" maxlength="2">
<label>图标</label>
<input type="text" id="newPersonalityIcon" placeholder="如:A" maxlength="2">
</div>
<div class="form-group">
<label>提示词</label>
@@ -188,7 +194,7 @@ const ConfigPage = {
list.innerHTML = this.personalities.map(p => `
<div style="display:flex;justify-content:space-between;align-items:center;padding:12px;background:var(--bg-secondary);border-radius:var(--radius);margin-bottom:8px;">
<div>
<span>${p.icon || '🤖'} ${this.escapeHtml(p.name)}</span>
<span>${p.icon ? '<span style="margin-right:4px;">' + this.escapeHtml(p.icon) + '</span>' : ''}${this.escapeHtml(p.name)}</span>
${p.is_preset ? '<span style="color:var(--warning);font-size:12px;margin-left:8px;">预设</span>' : '<span style="color:var(--success);font-size:12px;margin-left:8px;">自定义</span>'}
</div>
${!p.is_preset ? '<button class="btn btn-danger btn-sm" onclick="ConfigPage.deletePersonality(' + p.id + ')">删除</button>' : ''}

View File

@@ -1,6 +1,14 @@
<div class="login-container">
<div class="login-card">
<h1>🤖 AI Chat</h1>
<div class="login-logo">
<svg class="logo-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
<rect x="3" y="4" width="18" height="12" rx="3"/>
<circle cx="9" cy="10" r="1.5" fill="currentColor" stroke="none"/>
<circle cx="15" cy="10" r="1.5" fill="currentColor" stroke="none"/>
<path d="M8 16v2M16 16v2M12 16v3"/>
</svg>
<h1>AI Chat</h1>
</div>
<div id="loginError" class="alert alert-error" style="display:none;"></div>
<form id="loginForm">
<div class="form-group">