v1.0.2修复优化
This commit is contained in:
@@ -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',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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>' : ''}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -37,22 +37,36 @@ body {
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
padding: 20px;
|
||||
background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
|
||||
}
|
||||
|
||||
.login-card {
|
||||
background: var(--bg-card);
|
||||
border-radius: var(--radius);
|
||||
padding: 40px;
|
||||
border-radius: 12px;
|
||||
padding: 48px 40px;
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
box-shadow: 0 4px 20px rgba(0,0,0,0.3);
|
||||
max-width: 420px;
|
||||
box-shadow: 0 8px 32px rgba(0,0,0,0.3);
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.login-card h1 {
|
||||
.login-logo {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
margin-bottom: 36px;
|
||||
}
|
||||
|
||||
.login-logo .logo-icon {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
color: var(--primary);
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.login-logo h1 {
|
||||
font-size: 24px;
|
||||
color: var(--primary);
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
/* 安装向导样式 */
|
||||
@@ -62,6 +76,10 @@ body {
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
.install-container h1 svg {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.step-indicator {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
@@ -92,14 +110,16 @@ body {
|
||||
|
||||
/* 通用表单样式 */
|
||||
.form-group {
|
||||
margin-bottom: 16px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
display: block;
|
||||
margin-bottom: 6px;
|
||||
font-size: 14px;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
letter-spacing: 0.3px;
|
||||
}
|
||||
|
||||
.form-group input,
|
||||
@@ -124,14 +144,18 @@ body {
|
||||
|
||||
/* 按钮 */
|
||||
.btn {
|
||||
display: inline-block;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 10px 20px;
|
||||
border: none;
|
||||
border-radius: var(--radius);
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s;
|
||||
transition: all 0.2s ease;
|
||||
text-decoration: none;
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
@@ -141,6 +165,12 @@ body {
|
||||
|
||||
.btn-primary:hover {
|
||||
background: var(--primary-hover);
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 2px 8px rgba(74, 144, 217, 0.3);
|
||||
}
|
||||
|
||||
.btn-primary:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
@@ -149,18 +179,27 @@ body {
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
border-color: var(--primary);
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background: var(--danger);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-danger:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.btn-sm {
|
||||
padding: 6px 12px;
|
||||
padding: 6px 14px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.btn-block {
|
||||
display: block;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -168,7 +207,7 @@ body {
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
margin-top: 20px;
|
||||
margin-top: 24px;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
@@ -178,6 +217,7 @@ body {
|
||||
border-radius: var(--radius);
|
||||
margin-bottom: 16px;
|
||||
font-size: 14px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.alert-error {
|
||||
@@ -203,19 +243,34 @@ body {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 30px;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.config-header h1 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 22px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.config-header h1 svg {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.config-section {
|
||||
background: var(--bg-card);
|
||||
border-radius: var(--radius);
|
||||
padding: 24px;
|
||||
border-radius: 12px;
|
||||
padding: 28px;
|
||||
margin-bottom: 24px;
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
.config-section h2 {
|
||||
margin-bottom: 16px;
|
||||
font-size: 18px;
|
||||
margin-bottom: 20px;
|
||||
font-size: 17px;
|
||||
font-weight: 600;
|
||||
padding-bottom: 12px;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
/* 响应式 */
|
||||
|
||||
@@ -57,7 +57,7 @@ const ChatManager = {
|
||||
} else {
|
||||
let html = `<div class="message assistant">`;
|
||||
if (msg.thinking_content) {
|
||||
html += `<div class="thinking-toggle" onclick="this.nextElementSibling.classList.toggle('expanded')">💭 思考过程 ▾</div>`;
|
||||
html += `<div class="thinking-toggle" onclick="this.nextElementSibling.classList.toggle('expanded')">思考过程 ▾</div>`;
|
||||
html += `<div class="thinking-content">${MarkdownRenderer.render(msg.thinking_content)}</div>`;
|
||||
}
|
||||
html += `<div class="markdown-body">${MarkdownRenderer.render(msg.content)}</div>`;
|
||||
@@ -252,10 +252,10 @@ const ChatManager = {
|
||||
if (!toggle) {
|
||||
toggle = document.createElement('div');
|
||||
toggle.className = 'thinking-toggle expanded';
|
||||
toggle.textContent = '💭 思考过程 ▾';
|
||||
toggle.textContent = '思考过程 ▾';
|
||||
toggle.onclick = function() {
|
||||
container.classList.toggle('expanded');
|
||||
this.textContent = container.classList.contains('expanded') ? '💭 思考过程 ▴' : '💭 思考过程 ▾';
|
||||
this.textContent = container.classList.contains('expanded') ? '思考过程 ▴' : '思考过程 ▾';
|
||||
};
|
||||
el.insertBefore(toggle, el.firstChild);
|
||||
}
|
||||
@@ -279,7 +279,7 @@ const ChatManager = {
|
||||
const container = document.getElementById('messagesContainer');
|
||||
const el = document.createElement('div');
|
||||
el.className = 'message assistant';
|
||||
el.innerHTML = `<div class="alert alert-error">❌ ${this.escapeHtml(message)} <button class="btn btn-sm btn-secondary" onclick="ChatManager.retryLast()">重试</button></div>`;
|
||||
el.innerHTML = `<div class="alert alert-error">错误: ${this.escapeHtml(message)} <button class="btn btn-sm btn-secondary" onclick="ChatManager.retryLast()">重试</button></div>`;
|
||||
container.appendChild(el);
|
||||
container.scrollTop = container.scrollHeight;
|
||||
},
|
||||
|
||||
@@ -39,7 +39,7 @@ const UploadManager = {
|
||||
|
||||
preview.innerHTML = this.files.map((f, i) => `
|
||||
<div class="file-preview-item">
|
||||
<span>📎 ${this.escapeHtml(f.name)}</span>
|
||||
<span>${this.escapeHtml(f.name)}</span>
|
||||
<span class="remove-file" onclick="UploadManager.removeFile(${i})">×</span>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
@@ -28,7 +28,10 @@ if (file_exists($configFile)) {
|
||||
</head>
|
||||
<body>
|
||||
<div class="install-container">
|
||||
<h1>🤖 AI Chat 安装向导</h1>
|
||||
<h1>
|
||||
<svg viewBox="0 0 24 24" width="28" height="28" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="vertical-align:-6px;margin-right:10px;"><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>
|
||||
AI Chat 安装向导
|
||||
</h1>
|
||||
|
||||
<!-- 步骤指示器 -->
|
||||
<ul class="step-indicator">
|
||||
@@ -161,7 +164,7 @@ if (file_exists($configFile)) {
|
||||
container.innerHTML = checks.map(c => `
|
||||
<div class="check-item">
|
||||
<span>${c.name}</span>
|
||||
<span class="status ${c.pass ? 'pass' : 'fail'}">${c.pass ? '✓ 通过' : '✗ 未通过'}</span>
|
||||
<span class="status ${c.pass ? 'pass' : 'fail'}">${c.pass ? '通过' : '未通过'}</span>
|
||||
</div>
|
||||
`).join('');
|
||||
},
|
||||
@@ -317,7 +320,7 @@ if (file_exists($configFile)) {
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
result.innerHTML = '<div class="alert alert-success">✓ 安装成功!正在跳转到登录页...</div>';
|
||||
result.innerHTML = '<div class="alert alert-success">安装成功!正在跳转到登录页...</div>';
|
||||
setTimeout(() => { window.location.href = '/login.php'; }, 2000);
|
||||
} else {
|
||||
result.innerHTML = '<div class="alert alert-error">安装失败: ' + data.message + '</div>';
|
||||
|
||||
Reference in New Issue
Block a user