diff --git a/backend/app.py b/backend/app.py
index c6af9ca..08bf12f 100644
--- a/backend/app.py
+++ b/backend/app.py
@@ -1332,6 +1332,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 +1353,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': {
diff --git a/www/app.js b/www/app.js
index 6b7cce0..16b1e50 100644
--- a/www/app.js
+++ b/www/app.js
@@ -116,6 +116,16 @@ async function loadBackendConfig() {
};
}
+ // 加载工具列表
+ if (backendConfig.allTools) {
+ allTools = backendConfig.allTools;
+ }
+
+ // 加载默认启用的工具
+ if (backendConfig.tools) {
+ enabledTools = backendConfig.tools.map(t => t.tool_id);
+ }
+
updateAgentsDisplay();
console.log('后台配置已加载', backendConfig);
} catch (e) {
@@ -282,6 +292,8 @@ function getAgentConversationHistory(limit = 5) {
let enableThinking = false; // 深度思考
let enableSearch = false; // 联网搜索
let autoScrollEnabled = true; // 自动滚动(用户滚动后可关闭)
+let enabledTools = []; // 启用的工具列表(多选)
+let allTools = []; // 所有可用的工具列表
// DOM 元素(初始为 null,在 openConversation 时重新获取)
let appContainer = null;
@@ -3129,6 +3141,11 @@ function showAgentChatPage() {
联网搜索
+
+