Compare commits

..

38 Commits

Author SHA1 Message Date
dc2e822ea9 fix: 普通对话使用后台配置的LLM 2026-04-28 22:53:22 +08:00
53db607b8d feat: TTS文本清理,过滤Markdown特殊字符和表情 2026-04-28 17:59:15 +08:00
c346418d68 feat: TTS流式播放+新对话默认关闭 2026-04-28 17:51:47 +08:00
7de13ffc6d feat: AI回复语音播放功能(Edge TTS) 2026-04-28 17:28:07 +08:00
60db170c0d fix: 添加获取用户信息的GET API路由 2026-04-28 13:09:13 +08:00
336e3cd12f fix: 登录用户换设备后头像同步,初始化从后台获取最新用户信息 2026-04-28 13:05:54 +08:00
f0d9ca09aa fix: init_db兼容旧数据库,自动添加缺失的系统配置字段 2026-04-28 12:57:33 +08:00
36801e9266 feat: 我的页面和关于页面绑定后台系统配置 2026-04-28 12:48:51 +08:00
5acd9f08f1 fix: 发现智能体搜索支持基础智能体 2026-04-28 11:04:28 +08:00
31732a6303 fix: 历史使用左边标题右边智能体名字 2026-04-28 10:57:57 +08:00
7f576827b0 fix: 历史使用记录左边智能体名字右边标题 2026-04-28 10:55:15 +08:00
8287be10ea feat: 智能体对话标题自动更新+历史显示优化 2026-04-28 10:49:33 +08:00
a56bad11f1 feat: 用户头像在对话界面正确显示 2026-04-28 09:13:49 +08:00
92c187d576 fix: 智能体对话界面不显示工具选择按钮 2026-04-28 00:09:58 +08:00
9eeeace88c fix: 工具选择状态记忆 + 过滤联网搜索 + 默认未启用 2026-04-27 23:56:36 +08:00
ba5d49005b feat: 添加更多工具按钮,支持多选工具 2026-04-27 23:44:37 +08:00
c71f27072a feat: 系统设置可配置版本信息、技术基础、开发者等 2026-04-27 23:32:37 +08:00
22a109d6c0 feat: 用户头像上传功能 2026-04-27 20:02:40 +08:00
0244715a8a fix: LLM和搜索调用时记录统计到backend 2026-04-27 18:50:33 +08:00
1c3f7604c9 feat: 后台管理添加查看用户对话记录功能 2026-04-27 18:38:44 +08:00
0086eaa1d6 feat: 智能体数据同步到backend + 初始化时从backend加载完整数据 2026-04-27 18:33:15 +08:00
8e17ef5e15 fix: 登录时保存完整用户数据 2026-04-27 18:20:49 +08:00
773fb89b01 fix: 对话创建和消息发送时同步到backend 2026-04-27 18:20:06 +08:00
8199773ef6 feat: 用户对话数据同步到backend + 用户资料修改同步 2026-04-27 18:06:55 +08:00
d153986f3d fix: 隐藏注册页面验证码功能(暂时跳过验证) 2026-04-27 17:56:46 +08:00
e9357577cb feat: 后台管理添加用户管理功能 + 前端用户注册登录调用backend API 2026-04-27 17:16:44 +08:00
24ba04b3e3 fix: 智能体历史使用记录只显示真正有对话的智能体 2026-04-27 17:03:50 +08:00
d1ddd340c0 fix: API地址改为相对路径,适应不同设备访问 2026-04-27 15:41:46 +08:00
6ab58cb363 fix: 发现页面条件判断缺少结尾 2026-04-27 15:31:06 +08:00
ba8d0ae679 feat: 前端APP智能体从后台配置加载
- 从后台API(/api/config)获取智能体列表
- 热门智能体 = tags中包含hot标签
- 其他类别 = 根据category字段分类(basic/work/study/life)
- 游客限制从后台配置加载
2026-04-27 15:13:21 +08:00
52d98e88c6 fix: 弹框添加滚动功能 2026-04-27 15:02:31 +08:00
25dff98583 fix: 修复admin.js语法错误 2026-04-27 14:41:06 +08:00
6452e4c976 fix: admin.js版本号更新 2026-04-27 14:33:57 +08:00
f85991064f feat: 智能体管理增加上线开关、标签、可使用工具
智能体新增功能:
- 上线开关(is_online):点击快速切换,未上线则APP不可见
- 标签(tags):支持多标签,逗号分隔(hot/popular/new等)
- 可使用工具(enable_tools):配置智能体可用的工具列表

类别调整:
- 热门改为标签,不再是类别
- 类别改为: basic/work/study/life
- hot=热门标签, popular=推荐标签, new=新品标签

数据库变更:
- agents表新增 is_online 字段
- agents表新增 enable_tools 字段
- 移除 enable_search 字段(改为工具)

API新增:
- /api/admin/agents/<id>/online 切换上线状态
- 前端配置只返回上线且活跃的智能体
2026-04-27 14:15:14 +08:00
c725aeb192 fix: 对话配置扁平化+启用联网搜索移到对话配置
对话配置改为单配置:
- 只有一个默认配置,所有用户共用
- 去掉添加/删除配置按钮和逻辑
- 直接编辑保存配置

配置参数扁平化:
- enable_search 启用联网搜索开关
- LLM配置、可用工具、历史记录数、Temperature、系统提示词

启用联网搜索开关:
- 从系统设置移到对话配置页面
- 开关自动添加/移除 search 工具

系统设置简化:
- 去掉启用联网搜索开关
- 提示用户去对话配置页面设置
2026-04-27 13:04:03 +08:00
423f3aa717 feat: 后台增加对话配置+工具配置管理
新增对话配置页面:
- 配置普通对话使用的LLM、可用工具
- 历史记录数、Temperature、系统提示词
- 支持多配置、设为默认

搜索配置改为工具配置:
- 工具类型: search/calculator/image/code/weather/custom
- 搜索作为工具之一管理
- 支持添加多种工具
- 工具配置: ID、名称、类型、提供商、API、Key、额外配置

API新增:
- /api/admin/chat - 对话配置CRUD
- /api/admin/tools - 工具配置CRUD
- /api/config 返回 tools 和 chat_config
2026-04-27 12:51:44 +08:00
2f60e30169 fix: 端口改为19021 2026-04-27 12:38:50 +08:00
4442d5056a fix: SQL语句错误修复 + 版本号更新 2026-04-27 12:35:24 +08:00
5 changed files with 3165 additions and 353 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -4,6 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI助手 - 后台管理</title>
<link rel="stylesheet" href="admin.css?v=3.6.6">
<style>
:root {
--primary: #667eea;
@@ -318,6 +319,8 @@
border-radius: 16px;
max-width: 500px;
width: 90%;
max-height: 80vh;
overflow-y: auto;
}
.modal-header {
@@ -432,6 +435,10 @@
<span class="sidebar-icon">📊</span>
<span>统计信息</span>
</div>
<div class="sidebar-item" data-page="users">
<span class="sidebar-icon">👥</span>
<span>用户管理</span>
</div>
<div class="sidebar-item" data-page="llm">
<span class="sidebar-icon">🧠</span>
<span>大模型配置</span>
@@ -440,9 +447,13 @@
<span class="sidebar-icon">🤖</span>
<span>智能体管理</span>
</div>
<div class="sidebar-item" data-page="search">
<span class="sidebar-icon">🔍</span>
<span>搜索配置</span>
<div class="sidebar-item" data-page="chat">
<span class="sidebar-icon">💬</span>
<span>对话配置</span>
</div>
<div class="sidebar-item" data-page="tools">
<span class="sidebar-icon">🔧</span>
<span>工具配置</span>
</div>
<div class="sidebar-item" data-page="system">
<span class="sidebar-icon">⚙️</span>
@@ -466,6 +477,6 @@
</div>
</div>
<script src="admin.js?v=1.0.0"></script>
<script src="admin.js?v=3.6.6"></script>
</body>
</html>

File diff suppressed because it is too large Load Diff

1374
www/app.js

File diff suppressed because it is too large Load Diff

View File

@@ -1049,6 +1049,31 @@ body {
box-shadow: 0 0 8px rgba(102, 126, 234, 0.3);
}
.avatar-upload-section {
display: flex;
justify-content: center;
margin-bottom: 16px;
}
.avatar-upload-btn {
display: flex;
align-items: center;
gap: 8px;
padding: 12px 24px;
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
color: white;
border: none;
border-radius: 10px;
font-size: 14px;
cursor: pointer;
transition: all 0.2s;
}
.avatar-upload-btn:hover {
transform: scale(1.02);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}
.edit-input-group {
margin-bottom: 16px;
}
@@ -1705,6 +1730,16 @@ body {
color: var(--primary);
}
.recent-agent-title {
font-size: 14px;
color: #333;
font-weight: 500;
max-width: 120px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.recent-agent-agent-name {
font-size: 12px;
color: var(--primary);
@@ -1782,7 +1817,17 @@ body {
color: var(--primary);
}
.agent-history-agent {
.agent-history-title {
font-size: 14px;
color: #333;
font-weight: 500;
max-width: 150px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.agent-history-agent-name {
font-size: 12px;
color: var(--primary);
background: rgba(102, 126, 234, 0.1);
@@ -2350,7 +2395,8 @@ body {
font-size: 20px;
}
.clear-btn {
/* TTS 语音播放按钮 */
.tts-btn {
background: rgba(255,255,255,0.2);
border: none;
border-radius: 8px;
@@ -2359,10 +2405,18 @@ body {
cursor: pointer;
}
.clear-btn:active {
.tts-btn:hover {
background: rgba(255,255,255,0.3);
}
.tts-btn.active {
background: rgba(255,255,255,0.4);
}
.tts-btn svg {
display: block;
}
.messages-container {
flex: 1;
overflow-y: auto;
@@ -2715,6 +2769,193 @@ body {
flex-shrink: 0;
}
/* 更多工具按钮 */
.tools-btn {
position: relative;
}
.tools-count {
position: absolute;
top: -4px;
right: -4px;
min-width: 16px;
height: 16px;
padding: 0 4px;
background: #ef4444;
color: white;
font-size: 11px;
font-weight: 600;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
}
/* 工具选择弹窗 */
.tools-popup {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.tools-popup-content {
width: 90%;
max-width: 400px;
background: white;
border-radius: 16px;
overflow: hidden;
}
.tools-popup-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 20px;
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
color: white;
}
.tools-popup-header h3 {
margin: 0;
font-size: 18px;
}
.tools-popup-close {
width: 28px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
background: rgba(255, 255, 255, 0.2);
border: none;
border-radius: 14px;
color: white;
font-size: 20px;
cursor: pointer;
transition: background 0.2s;
}
.tools-popup-close:hover {
background: rgba(255, 255, 255, 0.3);
}
.tools-popup-body {
padding: 16px 20px;
}
.tools-popup-tip {
color: #718096;
font-size: 13px;
margin-bottom: 16px;
}
.tools-list {
display: flex;
flex-direction: column;
gap: 12px;
max-height: 300px;
overflow-y: auto;
}
.tool-option {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
background: #f5f7fa;
border: 2px solid transparent;
border-radius: 12px;
cursor: pointer;
transition: all 0.2s;
}
.tool-option:hover {
background: #e8ecf1;
}
.tool-option.selected {
background: rgba(102, 126, 234, 0.1);
border-color: var(--primary);
}
.tool-checkbox {
flex-shrink: 0;
color: #718096;
}
.tool-option.selected .tool-checkbox {
color: var(--primary);
}
.tool-icon {
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
background: white;
border-radius: 10px;
font-size: 20px;
}
.tool-info {
flex: 1;
}
.tool-name {
font-weight: 500;
color: #2d3748;
}
.tool-type {
font-size: 12px;
color: #718096;
margin-top: 2px;
}
.tools-popup-footer {
display: flex;
gap: 12px;
padding: 16px 20px;
background: #f5f7fa;
}
.tools-popup-btn {
flex: 1;
padding: 12px;
border: none;
border-radius: 10px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
}
.tools-popup-btn.cancel {
background: #e2e8f0;
color: #4a5568;
}
.tools-popup-btn.cancel:hover {
background: #cbd5e0;
}
.tools-popup-btn.confirm {
background: linear-gradient(135deg, var(--primary) 0%, #764ba2 100%);
color: white;
}
.tools-popup-btn.confirm:hover {
transform: scale(1.02);
}
/* 导航按钮样式 */
.nav-btn {
padding: 6px 8px;