Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f0d9ca09aa | |||
| 36801e9266 | |||
| 5acd9f08f1 | |||
| 31732a6303 | |||
| 7f576827b0 | |||
| 8287be10ea | |||
| a56bad11f1 | |||
| 92c187d576 | |||
| 9eeeace88c | |||
| ba5d49005b |
@@ -276,6 +276,20 @@ def init_db():
|
||||
]
|
||||
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', '', '用户协议链接'),
|
||||
]
|
||||
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')
|
||||
@@ -1332,6 +1346,10 @@ def get_frontend_config():
|
||||
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()]
|
||||
@@ -1349,6 +1367,7 @@ 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': {
|
||||
|
||||
254
www/app.js
254
www/app.js
@@ -116,6 +116,27 @@ async function loadBackendConfig() {
|
||||
};
|
||||
}
|
||||
|
||||
// 加载工具列表
|
||||
if (backendConfig.allTools) {
|
||||
// 过滤掉联网搜索(已有单独按钮)
|
||||
allTools = backendConfig.allTools.filter(t => t.type !== 'search');
|
||||
}
|
||||
|
||||
// 不加载默认启用的工具,所有工具默认未启用
|
||||
|
||||
// 将后台系统配置赋值到 CONFIG
|
||||
if (backendConfig.system) {
|
||||
CONFIG.system = backendConfig.system;
|
||||
}
|
||||
|
||||
// 将后台 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 +303,8 @@ function getAgentConversationHistory(limit = 5) {
|
||||
let enableThinking = false; // 深度思考
|
||||
let enableSearch = false; // 联网搜索
|
||||
let autoScrollEnabled = true; // 自动滚动(用户滚动后可关闭)
|
||||
let enabledTools = []; // 启用的工具列表(多选)
|
||||
let allTools = []; // 所有可用的工具列表
|
||||
|
||||
// DOM 元素(初始为 null,在 openConversation 时重新获取)
|
||||
let appContainer = null;
|
||||
@@ -779,7 +802,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 +1337,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 +1352,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'));
|
||||
@@ -2601,7 +2626,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('隐私政策链接未配置');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -2609,7 +2639,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('用户协议链接未配置');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -2993,10 +3028,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>
|
||||
@@ -3032,6 +3067,9 @@ async function openAgent(agentId) {
|
||||
currentAgent = systemAgents.find(a => a.id === agentId);
|
||||
if (!currentAgent) return;
|
||||
|
||||
// 加载该智能体的工具选择状态
|
||||
loadToolsState();
|
||||
|
||||
// 检查未登录用户的智能体限制
|
||||
if (!currentUser) {
|
||||
const check = canUseAgent(agentId);
|
||||
@@ -3074,7 +3112,7 @@ async function openAgent(agentId) {
|
||||
// 创建新对话并设置智能体
|
||||
const newConv = {
|
||||
id: backendId || Date.now().toString(),
|
||||
title: currentAgent.name,
|
||||
title: '新对话', // 和普通对话一样,初始标题为"新对话",后续自动生成
|
||||
messages: [],
|
||||
agentId: agentId,
|
||||
createdAt: Date.now(),
|
||||
@@ -3118,17 +3156,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">
|
||||
@@ -3220,6 +3251,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));
|
||||
@@ -3574,6 +3613,10 @@ function openConversation(id) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 普通对话,加载普通对话的工具状态
|
||||
currentAgent = null;
|
||||
loadToolsState();
|
||||
|
||||
// 渲染对话页面
|
||||
const chatHtml = `
|
||||
<div id="chatPage">
|
||||
@@ -3615,6 +3658,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="回到顶部">
|
||||
@@ -3697,6 +3745,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');
|
||||
@@ -4091,6 +4147,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 '👤';
|
||||
@@ -4350,7 +4566,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 = '';
|
||||
@@ -4425,7 +4645,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}
|
||||
|
||||
209
www/style.css
209
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);
|
||||
@@ -2740,6 +2760,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