Compare commits
17 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| dc2e822ea9 | |||
| 53db607b8d | |||
| c346418d68 | |||
| 7de13ffc6d | |||
| 60db170c0d | |||
| 336e3cd12f | |||
| f0d9ca09aa | |||
| 36801e9266 | |||
| 5acd9f08f1 | |||
| 31732a6303 | |||
| 7f576827b0 | |||
| 8287be10ea | |||
| a56bad11f1 | |||
| 92c187d576 | |||
| 9eeeace88c | |||
| ba5d49005b | |||
| c71f27072a |
116
backend/app.py
116
backend/app.py
@@ -4,7 +4,7 @@ AI Chat App - 后台管理服务
|
||||
端口: 19021 (与前端同一端口)
|
||||
"""
|
||||
|
||||
from flask import Flask, jsonify, request, send_from_directory
|
||||
from flask import Flask, jsonify, request, send_from_directory, Response
|
||||
from flask_cors import CORS
|
||||
import os
|
||||
import json
|
||||
@@ -12,6 +12,8 @@ import sqlite3
|
||||
from datetime import datetime
|
||||
import hashlib
|
||||
import base64
|
||||
import asyncio
|
||||
import edge_tts
|
||||
|
||||
app = Flask(__name__, static_folder='../www')
|
||||
CORS(app)
|
||||
@@ -260,16 +262,40 @@ def init_db():
|
||||
if cursor.fetchone()[0] == 0:
|
||||
default_configs = [
|
||||
('app_name', 'AI助手', '应用名称'),
|
||||
('app_version', '3.5.1', '应用版本'),
|
||||
('app_version', '3.10.0', '应用版本'),
|
||||
('llm_provider', 'zhipu', '默认大模型提供商'),
|
||||
('enable_search', 'true', '是否启用联网搜索'),
|
||||
('guest_chat_sessions', '1', '游客每日对话会话限制'),
|
||||
('guest_chat_messages', '20', '游客每日对话消息限制'),
|
||||
('guest_agent_messages', '20', '游客每日智能体消息限制'),
|
||||
('admin_password', 'admin123', '管理员密码'),
|
||||
('app_developer', 'OpenClaw Team', '开发者'),
|
||||
('app_update_date', '2026-04-27', '更新日期'),
|
||||
('app_technology', '智谱 GLM-4.5-Air 大模型', '技术基础'),
|
||||
('app_description', '提供智能对话、多种智能体服务', '应用简介'),
|
||||
('privacy_policy_url', '', '隐私政策链接'),
|
||||
('user_agreement_url', '', '用户协议链接'),
|
||||
('tts_provider', 'edge', 'TTS方案'),
|
||||
('tts_voice', 'zh-CN-XiaoxiaoNeural', 'TTS语音'),
|
||||
]
|
||||
for key, value, desc in default_configs:
|
||||
cursor.execute('INSERT INTO system_configs (key, value, description) VALUES (?, ?, ?)', (key, value, desc))
|
||||
else:
|
||||
# 检查并添加缺失的配置项(兼容旧数据库)
|
||||
default_configs = [
|
||||
('app_developer', 'OpenClaw Team', '开发者'),
|
||||
('app_update_date', '2026-04-27', '更新日期'),
|
||||
('app_technology', '智谱 GLM-4.5-Air 大模型', '技术基础'),
|
||||
('app_description', '提供智能对话、多种智能体服务', '应用简介'),
|
||||
('privacy_policy_url', '', '隐私政策链接'),
|
||||
('user_agreement_url', '', '用户协议链接'),
|
||||
('tts_provider', 'edge', 'TTS方案'),
|
||||
('tts_voice', 'zh-CN-XiaoxiaoNeural', 'TTS语音'),
|
||||
]
|
||||
for key, value, desc in default_configs:
|
||||
cursor.execute('SELECT COUNT(*) FROM system_configs WHERE key=?', (key,))
|
||||
if cursor.fetchone()[0] == 0:
|
||||
cursor.execute('INSERT INTO system_configs (key, value, description) VALUES (?, ?, ?)', (key, value, desc))
|
||||
|
||||
# 初始化管理员账户
|
||||
cursor.execute('SELECT COUNT(*) FROM admin_users')
|
||||
@@ -481,8 +507,9 @@ def get_users():
|
||||
|
||||
|
||||
@app.route('/api/admin/users/<int:id>', methods=['GET'])
|
||||
@app.route('/api/user/<int:id>', methods=['GET'])
|
||||
def get_user(id):
|
||||
"""获取单个用户"""
|
||||
"""获取单个用户信息"""
|
||||
conn = get_db()
|
||||
cursor = conn.cursor()
|
||||
cursor.execute('SELECT * FROM users WHERE id = ?', (id,))
|
||||
@@ -1318,22 +1345,32 @@ def get_frontend_config():
|
||||
conn = get_db()
|
||||
cursor = conn.cursor()
|
||||
|
||||
# 获取默认LLM配置
|
||||
cursor.execute('SELECT * FROM llm_configs WHERE is_default=1 AND is_active=1 LIMIT 1')
|
||||
# 先获取默认对话配置
|
||||
cursor.execute('SELECT * FROM chat_configs WHERE is_default=1 LIMIT 1')
|
||||
chat_config = cursor.fetchone()
|
||||
|
||||
# 根据对话配置中的 llm_config_id 获取对应的 LLM 配置
|
||||
llm_config_id = chat_config['llm_config_id'] if chat_config else 1
|
||||
cursor.execute('SELECT * FROM llm_configs WHERE id=?', (llm_config_id,))
|
||||
llm = cursor.fetchone()
|
||||
|
||||
# 如果找不到对应的LLM配置,使用默认的
|
||||
if not llm:
|
||||
cursor.execute('SELECT * FROM llm_configs WHERE is_default=1 LIMIT 1')
|
||||
llm = cursor.fetchone()
|
||||
|
||||
# 获取默认工具配置(搜索等)
|
||||
cursor.execute('SELECT * FROM tool_configs WHERE is_default=1 AND is_active=1')
|
||||
tools = [dict(row) for row in cursor.fetchall()]
|
||||
|
||||
# 获取所有活跃的工具配置(供前端选择)
|
||||
cursor.execute('SELECT tool_id, name, type, provider, is_active FROM tool_configs WHERE is_active=1')
|
||||
allTools = [dict(row) for row in cursor.fetchall()]
|
||||
|
||||
# 获取所有智能体(上线且活跃)
|
||||
cursor.execute('SELECT agent_id, name, avatar, category, description, system_prompt, heat, tags, enable_tools FROM agents WHERE is_online=1 AND is_active=1')
|
||||
agents = [dict(row) for row in cursor.fetchall()]
|
||||
|
||||
# 获取默认对话配置
|
||||
cursor.execute('SELECT * FROM chat_configs WHERE is_default=1 LIMIT 1')
|
||||
chat_config = cursor.fetchone()
|
||||
|
||||
# 获取系统配置
|
||||
cursor.execute('SELECT key, value FROM system_configs')
|
||||
system = {row['key']: row['value'] for row in cursor.fetchall()}
|
||||
@@ -1343,23 +1380,80 @@ def get_frontend_config():
|
||||
config = {
|
||||
'llm': dict(llm) if llm else None,
|
||||
'tools': tools,
|
||||
'allTools': allTools, # 所有活跃的工具(供前端选择)
|
||||
'agents': agents,
|
||||
'chat_config': dict(chat_config) if chat_config else None,
|
||||
'system': {
|
||||
'appName': system.get('app_name', 'AI助手'),
|
||||
'version': system.get('app_version', '3.6.0'),
|
||||
'version': system.get('app_version', '3.10.0'),
|
||||
'enableSearch': system.get('enable_search', 'true') == 'true',
|
||||
'guestLimits': {
|
||||
'chatSessions': int(system.get('guest_chat_sessions', '1')),
|
||||
'chatMessages': int(system.get('guest_chat_messages', '20')),
|
||||
'agentMessages': int(system.get('guest_agent_messages', '20')),
|
||||
}
|
||||
},
|
||||
'developer': system.get('app_developer', 'OpenClaw Team'),
|
||||
'updateDate': system.get('app_update_date', '2026-04-27'),
|
||||
'technology': system.get('app_technology', '智谱 GLM-4.5-Air 大模型'),
|
||||
'description': system.get('app_description', '提供智能对话、多种智能体服务'),
|
||||
'privacyPolicyUrl': system.get('privacy_policy_url', ''),
|
||||
'userAgreementUrl': system.get('user_agreement_url', ''),
|
||||
'ttsProvider': system.get('tts_provider', 'edge'),
|
||||
'ttsVoice': system.get('tts_voice', 'zh-CN-XiaoxiaoNeural'),
|
||||
}
|
||||
}
|
||||
|
||||
return jsonify(config)
|
||||
|
||||
|
||||
# ==================== TTS 语音合成 ====================
|
||||
|
||||
@app.route('/api/tts', methods=['POST'])
|
||||
def generate_tts():
|
||||
"""使用 Edge TTS 生成语音"""
|
||||
data = request.json
|
||||
text = data.get('text', '')
|
||||
voice = data.get('voice', 'zh-CN-XiaoxiaoNeural') # 默认中文女声
|
||||
|
||||
if not text:
|
||||
return jsonify({'error': '缺少文本内容'}), 400
|
||||
|
||||
try:
|
||||
# 使用 asyncio 运行 edge_tts
|
||||
async def generate_audio():
|
||||
communicate = edge_tts.Communicate(text, voice)
|
||||
audio_data = b''
|
||||
for chunk in communicate.stream_sync():
|
||||
if chunk['type'] == 'audio':
|
||||
audio_data += chunk['data']
|
||||
return audio_data
|
||||
|
||||
audio_data = asyncio.run(generate_audio())
|
||||
|
||||
# 返回音频数据(MP3格式)
|
||||
return Response(audio_data, mimetype='audio/mpeg')
|
||||
|
||||
except Exception as e:
|
||||
return jsonify({'error': f'TTS生成失败: {str(e)}'}), 500
|
||||
|
||||
|
||||
@app.route('/api/tts/voices', methods=['GET'])
|
||||
def get_tts_voices():
|
||||
"""获取可用的 TTS 语音列表"""
|
||||
try:
|
||||
voices = asyncio.run(edge_tts.list_voices())
|
||||
# 过滤中文语音
|
||||
chinese_voices = [v for v in voices if v['Locale'].startswith('zh-')]
|
||||
voice_list = [{
|
||||
'name': v['ShortName'],
|
||||
'gender': v['Gender'],
|
||||
'locale': v['Locale']
|
||||
} for v in chinese_voices]
|
||||
return jsonify({'voices': voice_list})
|
||||
except Exception as e:
|
||||
return jsonify({'error': f'获取语音列表失败: {str(e)}'}), 500
|
||||
|
||||
|
||||
# ==================== 启动 ====================
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
75
www/admin.js
75
www/admin.js
@@ -1355,6 +1355,26 @@ async function loadSystemPage(content) {
|
||||
<input type="text" class="form-input" id="appVersion" value="${systemConfigs.app_version?.value || ''}">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">应用简介</label>
|
||||
<input type="text" class="form-input" id="appDescription" value="${systemConfigs.app_description?.value || ''}" placeholder="如:提供智能对话、多种智能体服务">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">技术基础</label>
|
||||
<input type="text" class="form-input" id="appTechnology" value="${systemConfigs.app_technology?.value || ''}" placeholder="如:智谱 GLM-4.5-Air 大模型">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">开发者</label>
|
||||
<input type="text" class="form-input" id="appDeveloper" value="${systemConfigs.app_developer?.value || ''}" placeholder="如:OpenClaw Team">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">更新日期</label>
|
||||
<input type="text" class="form-input" id="appUpdateDate" value="${systemConfigs.app_update_date?.value || ''}" placeholder="如:2026-04-27">
|
||||
</div>
|
||||
|
||||
<h3 style="margin: 24px 0 16px; padding-top: 16px; border-top: 1px solid #e2e8f0;">游客使用限制</h3>
|
||||
|
||||
<div class="form-group">
|
||||
@@ -1379,6 +1399,51 @@ async function loadSystemPage(content) {
|
||||
<input type="text" class="form-input" id="adminPassword" value="${systemConfigs.admin_password?.value || ''}" placeholder="修改管理员密码">
|
||||
</div>
|
||||
|
||||
<h3 style="margin: 24px 0 16px; padding-top: 16px; border-top: 1px solid #e2e8f0;">TTS语音配置</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">TTS方案</label>
|
||||
<select class="form-input" id="ttsProvider">
|
||||
<option value="edge" ${systemConfigs.tts_provider?.value === 'edge' ? 'selected' : ''}>Edge TTS(免费)</option>
|
||||
</select>
|
||||
<span style="color: #999; font-size: 12px;">目前仅支持 Edge TTS,后续将添加更多方案</span>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">TTS语音</label>
|
||||
<select class="form-input" id="ttsVoice">
|
||||
<option value="zh-CN-XiaoxiaoNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaoxiaoNeural' ? 'selected' : ''}>晓晓(女声)</option>
|
||||
<option value="zh-CN-YunxiNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-YunxiNeural' ? 'selected' : ''}>云希(男声)</option>
|
||||
<option value="zh-CN-YunjianNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-YunjianNeural' ? 'selected' : ''}>云健(男声)</option>
|
||||
<option value="zh-CN-XiaoyiNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaoyiNeural' ? 'selected' : ''}>晓伊(女声)</option>
|
||||
<option value="zh-CN-YunfengNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-YunfengNeural' ? 'selected' : ''}>云枫(男声)</option>
|
||||
<option value="zh-CN-XiaochenNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaochenNeural' ? 'selected' : ''}>晓辰(女声)</option>
|
||||
<option value="zh-CN-XiaohanNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaohanNeural' ? 'selected' : ''}>晓涵(女声)</option>
|
||||
<option value="zh-CN-XiaomengNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaomengNeural' ? 'selected' : ''}>晓梦(女声)</option>
|
||||
<option value="zh-CN-XiaomoNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaomoNeural' ? 'selected' : ''}>晓墨(女声)</option>
|
||||
<option value="zh-CN-XiaoruiNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaoruiNeural' ? 'selected' : ''}>晓睿(女声)</option>
|
||||
<option value="zh-CN-XiaoshuangNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaoshuangNeural' ? 'selected' : ''}>晓双(女声)</option>
|
||||
<option value="zh-CN-XiaoxuanNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaoxuanNeural' ? 'selected' : ''}>晓萱(女声)</option>
|
||||
<option value="zh-CN-XiaoyanNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaoyanNeural' ? 'selected' : ''}>晓颜(女声)</option>
|
||||
<option value="zh-CN-XiaoyouNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-XiaoyouNeural' ? 'selected' : ''}>晓悠(女声)</option>
|
||||
<option value="zh-CN-YunyaNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-YunyaNeural' ? 'selected' : ''}>云雅(女声)</option>
|
||||
<option value="zh-CN-YunyangNeural" ${systemConfigs.tts_voice?.value === 'zh-CN-YunyangNeural' ? 'selected' : ''}>云扬(男声)</option>
|
||||
</select>
|
||||
<span style="color: #999; font-size: 12px;">选择AI回复的朗读语音</span>
|
||||
</div>
|
||||
|
||||
<h3 style="margin: 24px 0 16px; padding-top: 16px; border-top: 1px solid #e2e8f0;">链接配置</h3>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">隐私政策链接</label>
|
||||
<input type="text" class="form-input" id="privacyPolicyUrl" value="${systemConfigs.privacy_policy_url?.value || ''}" placeholder="隐私政策页面URL">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-label">用户协议链接</label>
|
||||
<input type="text" class="form-input" id="userAgreementUrl" value="${systemConfigs.user_agreement_url?.value || ''}" placeholder="用户协议页面URL">
|
||||
</div>
|
||||
|
||||
<button class="form-submit" onclick="saveSystemConfig()">保存设置</button>
|
||||
</div>
|
||||
|
||||
@@ -1394,10 +1459,18 @@ async function saveSystemConfig() {
|
||||
const data = {
|
||||
app_name: document.getElementById('appName').value,
|
||||
app_version: document.getElementById('appVersion').value,
|
||||
app_description: document.getElementById('appDescription').value,
|
||||
app_technology: document.getElementById('appTechnology').value,
|
||||
app_developer: document.getElementById('appDeveloper').value,
|
||||
app_update_date: document.getElementById('appUpdateDate').value,
|
||||
guest_chat_sessions: document.getElementById('guestChatSessions').value,
|
||||
guest_chat_messages: document.getElementById('guestChatMessages').value,
|
||||
guest_agent_messages: document.getElementById('guestAgentMessages').value,
|
||||
admin_password: document.getElementById('adminPassword').value
|
||||
admin_password: document.getElementById('adminPassword').value,
|
||||
privacy_policy_url: document.getElementById('privacyPolicyUrl').value,
|
||||
user_agreement_url: document.getElementById('userAgreementUrl').value,
|
||||
tts_provider: document.getElementById('ttsProvider').value,
|
||||
tts_voice: document.getElementById('ttsVoice').value,
|
||||
};
|
||||
|
||||
await fetchAPI('/api/admin/system', 'POST', data);
|
||||
|
||||
617
www/app.js
617
www/app.js
@@ -52,6 +52,13 @@ let backendConfig = null; // 从API获取的配置
|
||||
// 用户状态
|
||||
let currentUser = null; // 当前登录用户 { username, password, registeredAt }
|
||||
|
||||
// TTS 语音播放状态
|
||||
let enableTTS = false; // 是否启用语音播放(默认关闭)
|
||||
let currentPlayingAudio = null; // 当前播放的音频对象
|
||||
let ttsVoice = 'zh-CN-XiaoxiaoNeural'; // TTS 语音
|
||||
let ttsQueue = []; // TTS 待播放队列
|
||||
let isTTSPlaying = false; // 是否正在播放队列
|
||||
|
||||
// 每日使用统计(未登录用户)
|
||||
let dailyUsage = {
|
||||
date: null, // 日期 YYYY-MM-DD
|
||||
@@ -116,6 +123,29 @@ async function loadBackendConfig() {
|
||||
};
|
||||
}
|
||||
|
||||
// 加载工具列表
|
||||
if (backendConfig.allTools) {
|
||||
// 过滤掉联网搜索(已有单独按钮)
|
||||
allTools = backendConfig.allTools.filter(t => t.type !== 'search');
|
||||
}
|
||||
|
||||
// 不加载默认启用的工具,所有工具默认未启用
|
||||
|
||||
// 将后台系统配置赋值到 CONFIG
|
||||
if (backendConfig.system) {
|
||||
CONFIG.system = backendConfig.system;
|
||||
// 加载 TTS 配置
|
||||
ttsVoice = backendConfig.system.ttsVoice || 'zh-CN-XiaoxiaoNeural';
|
||||
}
|
||||
|
||||
// 将后台 LLM 配置赋值到 CONFIG
|
||||
if (backendConfig.llm) {
|
||||
CONFIG.apiUrl = backendConfig.llm.api_url;
|
||||
CONFIG.apiKey = backendConfig.llm.api_key;
|
||||
CONFIG.model = backendConfig.llm.model;
|
||||
CONFIG.maxTokens = backendConfig.llm.max_tokens || 2048;
|
||||
}
|
||||
|
||||
updateAgentsDisplay();
|
||||
console.log('后台配置已加载', backendConfig);
|
||||
} catch (e) {
|
||||
@@ -282,6 +312,8 @@ function getAgentConversationHistory(limit = 5) {
|
||||
let enableThinking = false; // 深度思考
|
||||
let enableSearch = false; // 联网搜索
|
||||
let autoScrollEnabled = true; // 自动滚动(用户滚动后可关闭)
|
||||
let enabledTools = []; // 启用的工具列表(多选)
|
||||
let allTools = []; // 所有可用的工具列表
|
||||
|
||||
// DOM 元素(初始为 null,在 openConversation 时重新获取)
|
||||
let appContainer = null;
|
||||
@@ -298,15 +330,41 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
// 初始化 appContainer
|
||||
appContainer = document.getElementById('app');
|
||||
|
||||
// 加载后台配置(包含 LLM、智能体等)
|
||||
await loadBackendConfig();
|
||||
|
||||
// 加载用户登录状态(优先检查)
|
||||
const savedUser = localStorage.getItem('currentUser');
|
||||
if (savedUser) {
|
||||
currentUser = JSON.parse(savedUser);
|
||||
}
|
||||
|
||||
// 如果用户已登录且有ID,从 backend 加载对话数据
|
||||
// 如果用户已登录且有ID,从 backend 加载最新用户信息和对话数据
|
||||
if (currentUser && currentUser.id) {
|
||||
try {
|
||||
// 从后台获取最新用户信息(包括头像)
|
||||
const userRes = await fetch(`/api/user/${currentUser.id}`);
|
||||
if (userRes.ok) {
|
||||
const userData = await userRes.json();
|
||||
if (userData && userData.id) {
|
||||
// 更新 currentUser 为后台最新数据
|
||||
currentUser = {
|
||||
id: userData.id,
|
||||
username: userData.username,
|
||||
phone: userData.phone || '',
|
||||
email: userData.email || '',
|
||||
avatar: userData.avatar || '👤',
|
||||
signature: userData.signature || '',
|
||||
gender: userData.gender || '',
|
||||
age: userData.age || '',
|
||||
region: userData.region || '',
|
||||
registeredAt: Date.now()
|
||||
};
|
||||
saveCurrentUser();
|
||||
}
|
||||
}
|
||||
|
||||
// 从 backend 加载对话数据
|
||||
const res = await fetch(`/api/user/${currentUser.id}/conversations`);
|
||||
const data = await res.json();
|
||||
if (Array.isArray(data) && data.length > 0) {
|
||||
@@ -414,13 +472,8 @@ document.addEventListener('DOMContentLoaded', async () => {
|
||||
currentPage = savedPage;
|
||||
}
|
||||
|
||||
// 加载后台配置并显示主页
|
||||
loadBackendConfig().then(() => {
|
||||
showMainPage();
|
||||
}).catch(() => {
|
||||
// 即使加载失败也显示主页
|
||||
showMainPage();
|
||||
});
|
||||
// 显示主页
|
||||
showMainPage();
|
||||
});
|
||||
|
||||
// 根据用户配置更新显示的智能体
|
||||
@@ -779,7 +832,7 @@ function renderAgentsPage() {
|
||||
<div class="recent-agent-item" data-conv-id="${conv.id}">
|
||||
<div class="recent-agent-left">
|
||||
<span class="recent-agent-avatar">${conv.agent ? conv.agent.avatar : '🤖'}</span>
|
||||
<span class="recent-agent-name">${conv.title}</span>
|
||||
<span class="recent-agent-title">${conv.title}</span>
|
||||
</div>
|
||||
<div class="recent-agent-right">
|
||||
<span class="recent-agent-agent-name">${conv.agent ? conv.agent.name : '未知智能体'}</span>
|
||||
@@ -1314,6 +1367,7 @@ function filterDiscoverAgents(keyword) {
|
||||
if (!keyword) {
|
||||
// 显示所有
|
||||
showDiscoverSection('hot', systemAgents.filter(a => a.category === 'hot'));
|
||||
showDiscoverSection('basic', systemAgents.filter(a => a.category === 'basic'));
|
||||
showDiscoverSection('work', systemAgents.filter(a => a.category === 'work'));
|
||||
showDiscoverSection('study', systemAgents.filter(a => a.category === 'study'));
|
||||
showDiscoverSection('life', systemAgents.filter(a => a.category === 'life'));
|
||||
@@ -1328,6 +1382,7 @@ function filterDiscoverAgents(keyword) {
|
||||
|
||||
// 显示搜索结果
|
||||
showDiscoverSection('hot', filtered.filter(a => a.category === 'hot'));
|
||||
showDiscoverSection('basic', filtered.filter(a => a.category === 'basic'));
|
||||
showDiscoverSection('work', filtered.filter(a => a.category === 'work'));
|
||||
showDiscoverSection('study', filtered.filter(a => a.category === 'study'));
|
||||
showDiscoverSection('life', filtered.filter(a => a.category === 'life'));
|
||||
@@ -1602,8 +1657,8 @@ function renderProfilePage() {
|
||||
</div>
|
||||
|
||||
<div class="profile-footer">
|
||||
<p>AI助手 v3.6.0</p>
|
||||
<p>基于智谱 GLM-4.5-Air</p>
|
||||
<p>${CONFIG?.system?.appName || 'AI助手'} v${CONFIG?.system?.version || '3.10.0'}</p>
|
||||
<p>基于 ${CONFIG?.system?.technology || '智谱 GLM-4.5-Air'}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -2524,6 +2579,13 @@ function showHelpPage() {
|
||||
// ==================== 关于页面 ====================
|
||||
|
||||
function showAboutPage() {
|
||||
const appName = CONFIG?.system?.appName || 'AI助手';
|
||||
const version = CONFIG?.system?.version || '3.10.0';
|
||||
const developer = CONFIG?.system?.developer || 'OpenClaw Team';
|
||||
const updateDate = CONFIG?.system?.updateDate || '2026-04-27';
|
||||
const technology = CONFIG?.system?.technology || '智谱 GLM-4.5-Air 大模型';
|
||||
const description = CONFIG?.system?.description || '提供智能对话、多种智能体服务';
|
||||
|
||||
const aboutHtml = `
|
||||
<div class="settings-page">
|
||||
<header class="settings-header">
|
||||
@@ -2535,22 +2597,22 @@ function showAboutPage() {
|
||||
|
||||
<div class="settings-content about-content">
|
||||
<div class="about-logo">🤖</div>
|
||||
<div class="about-name">AI助手</div>
|
||||
<div class="about-version">v3.5.0</div>
|
||||
<div class="about-name">${appName}</div>
|
||||
<div class="about-version">v${version}</div>
|
||||
|
||||
<div class="about-info">
|
||||
<p>基于智谱 GLM-4.5-Air 大模型</p>
|
||||
<p>提供智能对话、多种智能体服务</p>
|
||||
<p>基于 ${technology}</p>
|
||||
<p>${description}</p>
|
||||
</div>
|
||||
|
||||
<div class="about-section">
|
||||
<div class="about-item">
|
||||
<span class="about-label">开发者</span>
|
||||
<span class="about-value">OpenClaw Team</span>
|
||||
<span class="about-value">${developer}</span>
|
||||
</div>
|
||||
<div class="about-item">
|
||||
<span class="about-label">更新日期</span>
|
||||
<span class="about-value">2026-04-27</span>
|
||||
<span class="about-value">${updateDate}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -2594,7 +2656,12 @@ function showAboutPage() {
|
||||
const privacyPolicyBtn = document.getElementById('privacyPolicyBtn');
|
||||
if (privacyPolicyBtn) {
|
||||
privacyPolicyBtn.addEventListener('click', () => {
|
||||
showToast('隐私政策页面待完善');
|
||||
const privacyUrl = CONFIG?.system?.privacyPolicyUrl;
|
||||
if (privacyUrl) {
|
||||
window.open(privacyUrl, '_blank');
|
||||
} else {
|
||||
showToast('隐私政策链接未配置');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2602,7 +2669,12 @@ function showAboutPage() {
|
||||
const userAgreementBtn = document.getElementById('userAgreementBtn');
|
||||
if (userAgreementBtn) {
|
||||
userAgreementBtn.addEventListener('click', () => {
|
||||
showToast('用户协议页面待完善');
|
||||
const agreementUrl = CONFIG?.system?.userAgreementUrl;
|
||||
if (agreementUrl) {
|
||||
window.open(agreementUrl, '_blank');
|
||||
} else {
|
||||
showToast('用户协议链接未配置');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2986,10 +3058,10 @@ function showAgentHistoryPage() {
|
||||
<div class="agent-history-item" data-conv-id="${conv.id}">
|
||||
<div class="agent-history-left">
|
||||
<span class="agent-history-avatar">${conv.agent ? conv.agent.avatar : '🤖'}</span>
|
||||
<span class="agent-history-name">${conv.title}</span>
|
||||
<span class="agent-history-title">${conv.title}</span>
|
||||
</div>
|
||||
<div class="agent-history-right">
|
||||
<span class="agent-history-agent">${conv.agent ? conv.agent.name : '未知智能体'}</span>
|
||||
<span class="agent-history-agent-name">${conv.agent ? conv.agent.name : '未知智能体'}</span>
|
||||
<span class="agent-history-time">${formatTime(conv.updatedAt)}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -3025,6 +3097,9 @@ async function openAgent(agentId) {
|
||||
currentAgent = systemAgents.find(a => a.id === agentId);
|
||||
if (!currentAgent) return;
|
||||
|
||||
// 加载该智能体的工具选择状态
|
||||
loadToolsState();
|
||||
|
||||
// 检查未登录用户的智能体限制
|
||||
if (!currentUser) {
|
||||
const check = canUseAgent(agentId);
|
||||
@@ -3064,10 +3139,14 @@ async function openAgent(agentId) {
|
||||
}
|
||||
}
|
||||
|
||||
// 重置 TTS 状态(新对话默认关闭)
|
||||
enableTTS = false;
|
||||
stopTTSQueue();
|
||||
|
||||
// 创建新对话并设置智能体
|
||||
const newConv = {
|
||||
id: backendId || Date.now().toString(),
|
||||
title: currentAgent.name,
|
||||
title: '新对话', // 和普通对话一样,初始标题为"新对话",后续自动生成
|
||||
messages: [],
|
||||
agentId: agentId,
|
||||
createdAt: Date.now(),
|
||||
@@ -3086,6 +3165,9 @@ async function openAgent(agentId) {
|
||||
function showAgentChatPage() {
|
||||
if (!currentAgent || !currentConversation) return;
|
||||
|
||||
// 停止之前的 TTS 播放
|
||||
stopTTSQueue();
|
||||
|
||||
const chatHtml = `
|
||||
<div class="chat-page">
|
||||
<header class="chat-header">
|
||||
@@ -3099,6 +3181,9 @@ function showAgentChatPage() {
|
||||
<p class="agent-desc-header">${currentAgent.desc}</p>
|
||||
</div>
|
||||
</div>
|
||||
<button class="feature-btn tts-btn ${enableTTS ? 'active' : ''}" id="ttsBtn" title="语音播放">
|
||||
<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.54 7-8.77s-2.99-7.86-7-8.77z"/></svg>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<div class="messages-container" id="messagesContainer">
|
||||
@@ -3111,17 +3196,10 @@ function showAgentChatPage() {
|
||||
<div class="messages" id="messages"></div>
|
||||
</div>
|
||||
|
||||
<!-- 功能开关栏 -->
|
||||
<!-- 功能栏(智能体对话不需要工具选择,工具由后台配置) -->
|
||||
<div class="feature-bar" id="featureBar">
|
||||
<div class="feature-left">
|
||||
<button class="feature-btn thinking-btn" id="thinkingBtn">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"/></svg>
|
||||
<span>深度思考</span>
|
||||
</button>
|
||||
<button class="feature-btn search-btn" id="searchBtn">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 7 9.5 7 14 9.01 14 9.5 11.99 14 9.5 14z"/></svg>
|
||||
<span>联网搜索</span>
|
||||
</button>
|
||||
<!-- 智能体工具由后台配置,不显示选择按钮 -->
|
||||
</div>
|
||||
<div class="feature-right">
|
||||
<button class="feature-btn nav-btn" id="scrollTopBtn">
|
||||
@@ -3198,6 +3276,21 @@ function showAgentChatPage() {
|
||||
});
|
||||
}
|
||||
|
||||
// 绑定 TTS 开关按钮(智能体对话)
|
||||
const ttsBtn = document.getElementById('ttsBtn');
|
||||
if (ttsBtn) {
|
||||
ttsBtn.addEventListener('click', () => {
|
||||
enableTTS = !enableTTS;
|
||||
ttsBtn.classList.toggle('active', enableTTS);
|
||||
showToast(enableTTS ? '语音播放已开启' : '语音播放已关闭');
|
||||
// 如果关闭,停止当前播放
|
||||
if (!enableTTS && currentPlayingAudio) {
|
||||
currentPlayingAudio.pause();
|
||||
currentPlayingAudio = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 绑定功能开关按钮事件
|
||||
if (thinkingBtn) {
|
||||
thinkingBtn.addEventListener('click', () => {
|
||||
@@ -3213,6 +3306,14 @@ function showAgentChatPage() {
|
||||
});
|
||||
}
|
||||
|
||||
// 绑定更多工具按钮
|
||||
const moreToolsBtn = document.getElementById('moreToolsBtn');
|
||||
if (moreToolsBtn) {
|
||||
moreToolsBtn.addEventListener('click', () => {
|
||||
showToolsSelector();
|
||||
});
|
||||
}
|
||||
|
||||
// 绑定输入事件
|
||||
userInput.addEventListener('keydown', handleKeyDown);
|
||||
userInput.addEventListener('input', (e) => autoResize(e.target));
|
||||
@@ -3524,6 +3625,10 @@ async function createNewConversation() {
|
||||
return;
|
||||
}
|
||||
|
||||
// 重置 TTS 状态(新对话默认关闭)
|
||||
enableTTS = false;
|
||||
stopTTSQueue();
|
||||
|
||||
// 如果用户已登录,先在 backend 创建对话
|
||||
let backendId = null;
|
||||
if (currentUser && currentUser.id) {
|
||||
@@ -3561,12 +3666,19 @@ async function createNewConversation() {
|
||||
|
||||
// 打开对话
|
||||
function openConversation(id) {
|
||||
// 停止之前的 TTS 播放
|
||||
stopTTSQueue();
|
||||
|
||||
currentConversation = conversations.find(c => c.id === id);
|
||||
if (!currentConversation) {
|
||||
showConversationList();
|
||||
return;
|
||||
}
|
||||
|
||||
// 普通对话,加载普通对话的工具状态
|
||||
currentAgent = null;
|
||||
loadToolsState();
|
||||
|
||||
// 渲染对话页面
|
||||
const chatHtml = `
|
||||
<div id="chatPage">
|
||||
@@ -3578,8 +3690,8 @@ function openConversation(id) {
|
||||
<span class="logo">🤖</span>
|
||||
<h1>${escapeHtml(currentConversation.title)}</h1>
|
||||
</div>
|
||||
<button class="clear-btn" id="clearBtn" title="清空对话">
|
||||
<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z"/></svg>
|
||||
<button class="feature-btn tts-btn ${enableTTS ? 'active' : ''}" id="ttsBtn" title="语音播放">
|
||||
<svg viewBox="0 0 24 24" width="20" height="20"><path fill="currentColor" d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.54 7-8.77s-2.99-7.86-7-8.77z"/></svg>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
@@ -3608,6 +3720,11 @@ function openConversation(id) {
|
||||
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 7 9.5 7 14 9.01 14 9.5 11.99 14 9.5 14z"/></svg>
|
||||
<span>联网搜索</span>
|
||||
</button>
|
||||
<button class="feature-btn tools-btn" id="moreToolsBtn">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"/></svg>
|
||||
<span>更多工具</span>
|
||||
${enabledTools.length > 0 ? `<span class="tools-count">${enabledTools.length}</span>` : ''}
|
||||
</button>
|
||||
</div>
|
||||
<div class="feature-right">
|
||||
<button class="feature-btn nav-btn" id="scrollTopBtn" title="回到顶部">
|
||||
@@ -3672,8 +3789,20 @@ function openConversation(id) {
|
||||
const backBtn = document.getElementById('backBtn');
|
||||
if (backBtn) backBtn.addEventListener('click', showConversationList);
|
||||
|
||||
const clearBtn = document.getElementById('clearBtn');
|
||||
if (clearBtn) clearBtn.addEventListener('click', clearCurrentChat);
|
||||
// 绑定 TTS 开关按钮
|
||||
const ttsBtn = document.getElementById('ttsBtn');
|
||||
if (ttsBtn) {
|
||||
ttsBtn.addEventListener('click', () => {
|
||||
enableTTS = !enableTTS;
|
||||
ttsBtn.classList.toggle('active', enableTTS);
|
||||
showToast(enableTTS ? '语音播放已开启' : '语音播放已关闭');
|
||||
// 如果关闭,停止当前播放
|
||||
if (!enableTTS && currentPlayingAudio) {
|
||||
currentPlayingAudio.pause();
|
||||
currentPlayingAudio = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 绑定功能开关按钮事件
|
||||
if (thinkingBtn) {
|
||||
@@ -3690,6 +3819,14 @@ function openConversation(id) {
|
||||
});
|
||||
}
|
||||
|
||||
// 绑定更多工具按钮
|
||||
const moreToolsBtn = document.getElementById('moreToolsBtn');
|
||||
if (moreToolsBtn) {
|
||||
moreToolsBtn.addEventListener('click', () => {
|
||||
showToolsSelector();
|
||||
});
|
||||
}
|
||||
|
||||
// 绑定置顶置底按钮事件
|
||||
const scrollTopBtn = document.getElementById('scrollTopBtn');
|
||||
const scrollBottomBtn = document.getElementById('scrollBottomBtn');
|
||||
@@ -3967,6 +4104,8 @@ async function streamGenerate(userMsgIndex) {
|
||||
let buffer = '';
|
||||
let thinkingOutputStarted = false; // 正式内容是否开始输出
|
||||
let abortController = new AbortController(); // 用于中断流
|
||||
let ttsAccumulatedText = ''; // TTS 累计文本
|
||||
let ttsLastPlayedIndex = 0; // 上次播放的文本位置
|
||||
|
||||
// 绑定停止按钮事件
|
||||
const stopBtn = document.getElementById('stopGenerateBtn');
|
||||
@@ -4036,6 +4175,32 @@ async function streamGenerate(userMsgIndex) {
|
||||
|
||||
currentConversation.messages[aiMessageIndex].content += delta.content;
|
||||
contentEl.innerHTML = renderMarkdown(currentConversation.messages[aiMessageIndex].content) + '<span class="streaming-cursor">▌</span>';
|
||||
|
||||
// 流式TTS播放:积累文本并播放
|
||||
if (enableTTS) {
|
||||
ttsAccumulatedText += delta.content;
|
||||
// 每80字符播放一段(避免太短频繁请求)
|
||||
if (ttsAccumulatedText.length >= 80) {
|
||||
// 找到合适的断句点(句子结束)
|
||||
const breakPoints = ['。', '!', '?', ';', '.', '!', '?', ';', '\n'];
|
||||
let breakIndex = -1;
|
||||
for (let i = ttsAccumulatedText.length - 1; i >= ttsLastPlayedIndex + 40; i--) {
|
||||
if (breakPoints.includes(ttsAccumulatedText[i])) {
|
||||
breakIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 如果找到断句点,或者积累超过120字符强制播放
|
||||
if (breakIndex >= 0 || ttsAccumulatedText.length - ttsLastPlayedIndex >= 120) {
|
||||
const textToPlay = ttsAccumulatedText.slice(ttsLastPlayedIndex, breakIndex >= 0 ? breakIndex + 1 : ttsAccumulatedText.length);
|
||||
if (textToPlay.trim()) {
|
||||
addToTTSQueue(textToPlay.trim());
|
||||
}
|
||||
ttsLastPlayedIndex = breakIndex >= 0 ? breakIndex + 1 : ttsAccumulatedText.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scrollToBottom();
|
||||
}
|
||||
}
|
||||
@@ -4049,11 +4214,21 @@ async function streamGenerate(userMsgIndex) {
|
||||
thinkingEl.innerHTML = renderMarkdown(currentConversation.messages[aiMessageIndex].thinking);
|
||||
}
|
||||
contentEl.innerHTML = renderMarkdown(currentConversation.messages[aiMessageIndex].content);
|
||||
|
||||
// 播放剩余未播放的文本(流式TTS)
|
||||
if (enableTTS && ttsAccumulatedText && ttsLastPlayedIndex < ttsAccumulatedText.length) {
|
||||
const remainingText = ttsAccumulatedText.slice(ttsLastPlayedIndex).trim();
|
||||
if (remainingText) {
|
||||
addToTTSQueue(remainingText);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
currentConversation.messages[aiMessageIndex].content = `抱歉,出现了错误:${error.message}\n\n请检查网络连接后重试。`;
|
||||
contentEl.innerHTML = renderMarkdown(currentConversation.messages[aiMessageIndex].content);
|
||||
// 出错时停止TTS队列
|
||||
stopTTSQueue();
|
||||
} finally {
|
||||
isLoading = false;
|
||||
sendBtn.disabled = false;
|
||||
@@ -4084,6 +4259,166 @@ function logStatsToBackend(type, key, value = 1) {
|
||||
}).catch(e => console.error('统计记录失败:', e));
|
||||
}
|
||||
|
||||
// 显示工具选择弹窗
|
||||
function showToolsSelector() {
|
||||
if (allTools.length === 0) {
|
||||
showToast('暂无可用工具');
|
||||
return;
|
||||
}
|
||||
|
||||
// 工具类型图标映射
|
||||
const toolIcons = {
|
||||
search: '🔍',
|
||||
calculator: '🧮',
|
||||
image: '🎨',
|
||||
code: '💻',
|
||||
weather: '🌤️',
|
||||
custom: '🔧'
|
||||
};
|
||||
|
||||
const toolsHtml = allTools.map(tool => `
|
||||
<div class="tool-option ${enabledTools.includes(tool.tool_id) ? 'selected' : ''}" data-tool-id="${tool.tool_id}">
|
||||
<div class="tool-checkbox">
|
||||
<svg viewBox="0 0 24 24" width="20" height="20">
|
||||
${enabledTools.includes(tool.tool_id)
|
||||
? '<path fill="currentColor" d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 14l-5-5 1.41-1.41L12 14.17l4.59-4.58L18 10l-6 6z"/>'
|
||||
: '<path fill="currentColor" d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/>'
|
||||
}
|
||||
</svg>
|
||||
</div>
|
||||
<div class="tool-icon">${toolIcons[tool.type] || '🔧'}</div>
|
||||
<div class="tool-info">
|
||||
<div class="tool-name">${tool.name}</div>
|
||||
<div class="tool-type">${tool.type}</div>
|
||||
</div>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
const popupHtml = `
|
||||
<div class="tools-popup" id="toolsPopup">
|
||||
<div class="tools-popup-content">
|
||||
<div class="tools-popup-header">
|
||||
<h3>选择工具</h3>
|
||||
<button class="tools-popup-close" id="toolsPopupClose">×</button>
|
||||
</div>
|
||||
<div class="tools-popup-body">
|
||||
<p class="tools-popup-tip">勾选要启用的工具(多选)</p>
|
||||
<div class="tools-list">
|
||||
${toolsHtml}
|
||||
</div>
|
||||
</div>
|
||||
<div class="tools-popup-footer">
|
||||
<button class="tools-popup-btn cancel" id="toolsCancelBtn">取消</button>
|
||||
<button class="tools-popup-btn confirm" id="toolsConfirmBtn">确认</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
// 添加到页面
|
||||
const existingPopup = document.getElementById('toolsPopup');
|
||||
if (existingPopup) existingPopup.remove();
|
||||
|
||||
document.body.appendChild(document.createElement('div'));
|
||||
document.body.lastElementChild.outerHTML = popupHtml;
|
||||
|
||||
// 绑定事件
|
||||
document.querySelectorAll('.tool-option').forEach(option => {
|
||||
option.addEventListener('click', () => {
|
||||
option.classList.toggle('selected');
|
||||
// 更新复选框图标
|
||||
const checkbox = option.querySelector('.tool-checkbox svg');
|
||||
const isSelected = option.classList.contains('selected');
|
||||
checkbox.innerHTML = isSelected
|
||||
? '<path fill="currentColor" d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 14l-5-5 1.41-1.41L12 14.17l4.59-4.58L18 10l-6 6z"/>'
|
||||
: '<path fill="currentColor" d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"/>';
|
||||
});
|
||||
});
|
||||
|
||||
// 关闭按钮
|
||||
document.getElementById('toolsPopupClose').addEventListener('click', closeToolsPopup);
|
||||
document.getElementById('toolsCancelBtn').addEventListener('click', closeToolsPopup);
|
||||
document.getElementById('toolsConfirmBtn').addEventListener('click', confirmToolsSelection);
|
||||
|
||||
// 点击背景关闭
|
||||
document.getElementById('toolsPopup').addEventListener('click', (e) => {
|
||||
if (e.target.id === 'toolsPopup') {
|
||||
closeToolsPopup();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function closeToolsPopup() {
|
||||
const popup = document.getElementById('toolsPopup');
|
||||
if (popup) popup.remove();
|
||||
}
|
||||
|
||||
function confirmToolsSelection() {
|
||||
// 获取选中的工具
|
||||
const selectedTools = [];
|
||||
document.querySelectorAll('.tool-option.selected').forEach(option => {
|
||||
selectedTools.push(option.getAttribute('data-tool-id'));
|
||||
});
|
||||
|
||||
enabledTools = selectedTools;
|
||||
|
||||
// 保存工具选择状态
|
||||
saveToolsState();
|
||||
|
||||
// 更新按钮显示
|
||||
const moreToolsBtn = document.getElementById('moreToolsBtn');
|
||||
if (moreToolsBtn) {
|
||||
const countSpan = moreToolsBtn.querySelector('.tools-count');
|
||||
if (enabledTools.length > 0) {
|
||||
if (countSpan) {
|
||||
countSpan.textContent = enabledTools.length;
|
||||
} else {
|
||||
const span = document.createElement('span');
|
||||
span.className = 'tools-count';
|
||||
span.textContent = enabledTools.length;
|
||||
moreToolsBtn.appendChild(span);
|
||||
}
|
||||
} else if (countSpan) {
|
||||
countSpan.remove();
|
||||
}
|
||||
}
|
||||
|
||||
closeToolsPopup();
|
||||
showToast(`已启用 ${enabledTools.length} 个工具`);
|
||||
}
|
||||
|
||||
// 保存工具选择状态
|
||||
function saveToolsState() {
|
||||
if (currentAgent) {
|
||||
// 智能体对话:保存到 localStorage(按智能体ID)
|
||||
localStorage.setItem(`agentEnabledTools_${currentAgent.id}`, JSON.stringify(enabledTools));
|
||||
} else {
|
||||
// 普通对话:保存到 localStorage
|
||||
localStorage.setItem('chatEnabledTools', JSON.stringify(enabledTools));
|
||||
}
|
||||
}
|
||||
|
||||
// 加载工具选择状态
|
||||
function loadToolsState() {
|
||||
if (currentAgent) {
|
||||
// 智能体对话:加载该智能体的工具状态
|
||||
const saved = localStorage.getItem(`agentEnabledTools_${currentAgent.id}`);
|
||||
if (saved) {
|
||||
enabledTools = JSON.parse(saved);
|
||||
} else {
|
||||
enabledTools = [];
|
||||
}
|
||||
} else {
|
||||
// 普通对话:加载普通对话的工具状态
|
||||
const saved = localStorage.getItem('chatEnabledTools');
|
||||
if (saved) {
|
||||
enabledTools = JSON.parse(saved);
|
||||
} else {
|
||||
enabledTools = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 渲染头像(支持 emoji 和上传的图片)
|
||||
function renderAvatar(avatar) {
|
||||
if (!avatar) return '👤';
|
||||
@@ -4343,7 +4678,11 @@ function renderMessages() {
|
||||
|
||||
messagesDiv.innerHTML = currentConversation.messages.map((msg, index) => {
|
||||
const isUser = msg.role === 'user';
|
||||
const avatar = isUser ? '👤' : '🤖';
|
||||
// 用户头像使用实际头像,AI头像使用智能体头像或默认
|
||||
const avatar = isUser
|
||||
? (currentUser?.avatar || '👤')
|
||||
: (currentAgent?.avatar || '🤖');
|
||||
const avatarHtml = isUser ? renderAvatar(avatar) : avatar;
|
||||
|
||||
// 处理消息内容(支持图片)
|
||||
let contentHtml = '';
|
||||
@@ -4399,6 +4738,8 @@ function renderMessages() {
|
||||
|
||||
const copyIcon = `<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"/></svg>`;
|
||||
|
||||
const playIcon = `<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.54 7-8.77s-2.99-7.86-7-8.77z"/></svg>`;
|
||||
|
||||
const actions = isUser
|
||||
? `<div class="message-actions">
|
||||
<button class="action-btn copy-btn" data-index="${index}" title="复制">${copyIcon}</button>
|
||||
@@ -4407,6 +4748,7 @@ function renderMessages() {
|
||||
</button>
|
||||
</div>`
|
||||
: `<div class="message-actions">
|
||||
<button class="action-btn tts-btn" data-index="${index}" title="语音播放">${playIcon}</button>
|
||||
<button class="action-btn copy-btn" data-index="${index}" title="复制">${copyIcon}</button>
|
||||
<button class="action-btn regenerate-btn" data-index="${index}" title="重新生成">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16"><path fill="currentColor" d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/></svg>
|
||||
@@ -4418,7 +4760,7 @@ function renderMessages() {
|
||||
|
||||
return `
|
||||
<div class="message ${msg.role}" data-index="${index}">
|
||||
<div class="message-avatar">${avatar}</div>
|
||||
<div class="message-avatar">${avatarHtml}</div>
|
||||
<div class="message-body">
|
||||
${searchHtml}
|
||||
${thinkingHtml}
|
||||
@@ -4430,6 +4772,9 @@ function renderMessages() {
|
||||
}).join('');
|
||||
|
||||
// 绑定消息操作按钮事件(事件委托)
|
||||
messagesDiv.querySelectorAll('.tts-btn').forEach(btn => {
|
||||
btn.addEventListener('click', () => playTTS(parseInt(btn.dataset.index)));
|
||||
});
|
||||
messagesDiv.querySelectorAll('.copy-btn').forEach(btn => {
|
||||
btn.addEventListener('click', () => copyMessage(parseInt(btn.dataset.index)));
|
||||
});
|
||||
@@ -4443,6 +4788,204 @@ function renderMessages() {
|
||||
scrollToBottom();
|
||||
}
|
||||
|
||||
// ==================== TTS 队列播放 ====================
|
||||
|
||||
// 清理 TTS 文本(过滤Markdown特殊字符和表情)
|
||||
function cleanTTSText(text) {
|
||||
if (!text) return '';
|
||||
|
||||
let cleaned = text;
|
||||
|
||||
// 移除代码块(```code```)
|
||||
cleaned = cleaned.replace(/```[\s\S]*?```/g, '');
|
||||
|
||||
// 移除行内代码(`code`)
|
||||
cleaned = cleaned.replace(/`[^`]+`/g, '');
|
||||
|
||||
// 移除标题符号(#、##、###等)
|
||||
cleaned = cleaned.replace(/^#{1,6}\s*/gm, '');
|
||||
|
||||
// 移除列表符号(-、*、+)
|
||||
cleaned = cleaned.replace(/^[\-\*\+]\s+/gm, '');
|
||||
|
||||
// 移除数字列表(1.、2.等)
|
||||
cleaned = cleaned.replace(/^\d+\.\s+/gm, '');
|
||||
|
||||
// 处理链接 [text](url) -> 只保留text
|
||||
cleaned = cleaned.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
|
||||
|
||||
// 移除粗体/斜体符号(**text**、*text*、__text__、_text_)
|
||||
cleaned = cleaned.replace(/\*\*([^*]+)\*\*/g, '$1');
|
||||
cleaned = cleaned.replace(/\*([^*]+)\*/g, '$1');
|
||||
cleaned = cleaned.replace(/__([^_]+)__/g, '$1');
|
||||
cleaned = cleaned.replace(/_([^_]+)_/g, '$1');
|
||||
|
||||
// 移除引用符号(>)
|
||||
cleaned = cleaned.replace(/^>\s*/gm, '');
|
||||
|
||||
// 移除分割线(---、***)
|
||||
cleaned = cleaned.replace(/^[\-\*]{3,}$/gm, '');
|
||||
|
||||
// 移除表情符号(常见emoji范围)
|
||||
cleaned = cleaned.replace(/[\u{1F600}-\u{1F64F}]/gu, ''); // 表情
|
||||
cleaned = cleaned.replace(/[\u{1F300}-\u{1F5FF}]/gu, ''); // 符号和图形
|
||||
cleaned = cleaned.replace(/[\u{1F680}-\u{1F6FF}]/gu, ''); // 交通和地图
|
||||
cleaned = cleaned.replace(/[\u{1F700}-\u{1F77F}]/gu, ''); // 占星术
|
||||
cleaned = cleaned.replace(/[\u{1F780}-\u{1F7FF}]/gu, ''); // 几何图形
|
||||
cleaned = cleaned.replace(/[\u{1F800}-\u{1F8FF}]/gu, ''); // 补充箭头
|
||||
cleaned = cleaned.replace(/[\u{1F900}-\u{1F9FF}]/gu, ''); // 补充符号
|
||||
cleaned = cleaned.replace(/[\u{1FA00}-\u{1FA6F}]/gu, ''); // 游戏符号
|
||||
cleaned = cleaned.replace(/[\u{1FA70}-\u{1FAFF}]/gu, ''); // 补充符号B
|
||||
cleaned = cleaned.replace(/[\u{2600}-\u{26FF}]/gu, ''); // 杂项符号
|
||||
cleaned = cleaned.replace(/[\u{2700}-\u{27BF}]/gu, ''); // 装饰符号
|
||||
cleaned = cleaned.replace(/[\u{FE00}-\u{FE0F}]/gu, ''); // 变体选择符
|
||||
cleaned = cleaned.replace(/[\u{1F1E0}-\u{1F1FF}]/gu, ''); // 旗帜
|
||||
|
||||
// 移除HTML实体
|
||||
cleaned = cleaned.replace(/&[a-zA-Z]+;/g, '');
|
||||
|
||||
// 清理多余空白
|
||||
cleaned = cleaned.replace(/\s+/g, ' ').trim();
|
||||
|
||||
return cleaned;
|
||||
}
|
||||
|
||||
// 添加文本到 TTS 队列
|
||||
async function addToTTSQueue(text) {
|
||||
if (!text || !enableTTS) return;
|
||||
|
||||
ttsQueue.push(text);
|
||||
|
||||
// 如果没有在播放,开始播放队列
|
||||
if (!isTTSPlaying) {
|
||||
playTTSQueue();
|
||||
}
|
||||
}
|
||||
|
||||
// 播放 TTS 队列
|
||||
async function playTTSQueue() {
|
||||
if (ttsQueue.length === 0) {
|
||||
isTTSPlaying = false;
|
||||
return;
|
||||
}
|
||||
|
||||
isTTSPlaying = true;
|
||||
|
||||
while (ttsQueue.length > 0 && enableTTS) {
|
||||
const rawText = ttsQueue.shift();
|
||||
const text = cleanTTSText(rawText); // 清理文本
|
||||
|
||||
if (!text) continue; // 跳过空文本
|
||||
|
||||
try {
|
||||
const response = await fetch('/api/tts', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ text, voice: ttsVoice })
|
||||
});
|
||||
|
||||
if (!response.ok || !enableTTS) break;
|
||||
|
||||
const audioBlob = await response.blob();
|
||||
const audioUrl = URL.createObjectURL(audioBlob);
|
||||
|
||||
// 播放音频
|
||||
currentPlayingAudio = new Audio(audioUrl);
|
||||
await currentPlayingAudio.play();
|
||||
|
||||
// 等待播放完成
|
||||
await new Promise(resolve => {
|
||||
currentPlayingAudio.onended = resolve;
|
||||
currentPlayingAudio.onerror = resolve;
|
||||
});
|
||||
|
||||
URL.revokeObjectURL(audioUrl);
|
||||
currentPlayingAudio = null;
|
||||
|
||||
} catch (e) {
|
||||
console.error('TTS播放失败:', e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
isTTSPlaying = false;
|
||||
ttsQueue = []; // 清空队列
|
||||
}
|
||||
|
||||
// 停止 TTS 队列播放
|
||||
function stopTTSQueue() {
|
||||
ttsQueue = [];
|
||||
isTTSPlaying = false;
|
||||
if (currentPlayingAudio) {
|
||||
currentPlayingAudio.pause();
|
||||
currentPlayingAudio = null;
|
||||
}
|
||||
}
|
||||
|
||||
// TTS 手动播放(点击消息上的播放按钮)
|
||||
async function playTTS(index) {
|
||||
if (!currentConversation || index < 0) return;
|
||||
|
||||
const msg = currentConversation.messages[index];
|
||||
if (!msg || msg.role !== 'assistant') return;
|
||||
|
||||
const rawText = msg.content;
|
||||
if (!rawText) {
|
||||
showToast('没有可播放的内容');
|
||||
return;
|
||||
}
|
||||
|
||||
const text = cleanTTSText(rawText); // 清理文本
|
||||
if (!text) {
|
||||
showToast('没有可播放的内容');
|
||||
return;
|
||||
}
|
||||
|
||||
// 如果正在播放或队列中有内容,停止
|
||||
if (currentPlayingAudio || isTTSPlaying) {
|
||||
stopTTSQueue();
|
||||
showToast('已停止播放');
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用后端 TTS API
|
||||
try {
|
||||
showToast('正在生成语音...');
|
||||
|
||||
const response = await fetch('/api/tts', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ text, voice: ttsVoice })
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const error = await response.json();
|
||||
showToast(error.error || '语音生成失败');
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取音频数据
|
||||
const audioBlob = await response.blob();
|
||||
const audioUrl = URL.createObjectURL(audioBlob);
|
||||
|
||||
// 播放音频
|
||||
currentPlayingAudio = new Audio(audioUrl);
|
||||
await currentPlayingAudio.play();
|
||||
|
||||
showToast('开始播放');
|
||||
|
||||
// 播放完成后释放资源
|
||||
currentPlayingAudio.onended = () => {
|
||||
URL.revokeObjectURL(audioUrl);
|
||||
currentPlayingAudio = null;
|
||||
};
|
||||
|
||||
} catch (e) {
|
||||
console.error('TTS播放失败:', e);
|
||||
showToast('语音播放失败');
|
||||
}
|
||||
}
|
||||
|
||||
// 折叠/展开思考内容
|
||||
function toggleThinking(block) {
|
||||
block.classList.toggle('expanded');
|
||||
|
||||
222
www/style.css
222
www/style.css
@@ -1730,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);
|
||||
@@ -1807,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);
|
||||
@@ -2375,7 +2395,8 @@ body {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.clear-btn {
|
||||
/* TTS 语音播放按钮 */
|
||||
.tts-btn {
|
||||
background: rgba(255,255,255,0.2);
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
@@ -2384,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;
|
||||
@@ -2740,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;
|
||||
|
||||
Reference in New Issue
Block a user