From 313f386c56cadaf6f45af25584288a63ff53400a Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Wed, 24 Dec 2025 18:14:24 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E6=B5=AE=E5=8A=A8?= =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E7=9A=84z-index=E5=80=BC=E4=BB=A5?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E9=87=8D=E5=8F=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/components/AgentChatComponent.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/components/AgentChatComponent.vue b/web/src/components/AgentChatComponent.vue index 52612625..4235d46a 100644 --- a/web/src/components/AgentChatComponent.vue +++ b/web/src/components/AgentChatComponent.vue @@ -1043,7 +1043,7 @@ watch(conversations, () => { .floating-sidebar { position: absolute !important; - z-index: 100; + z-index: 101; height: 100%; left: 0; top: 0; From 606afc99ee89f6f301a117e130a2b511e34a22b5 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Wed, 24 Dec 2025 18:52:14 +0800 Subject: [PATCH 2/7] =?UTF-8?q?feat(agent):=20=E6=B7=BB=E5=8A=A0=E5=BC=BA?= =?UTF-8?q?=E5=88=B6=E5=88=B7=E6=96=B0=E6=99=BA=E8=83=BD=E4=BD=93=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E7=9A=84=E5=8A=9F=E8=83=BD=20Fixes=20#396?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改 fetchAgentDetail 方法支持强制刷新参数 更新上下文配置选项为动态获取 调整工具和MCP服务器列表为实时获取 --- src/agents/chatbot/context.py | 8 ++++++-- src/agents/common/context.py | 6 +++++- web/src/components/AgentConfigSidebar.vue | 4 ++++ web/src/stores/agent.js | 6 +++--- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/agents/chatbot/context.py b/src/agents/chatbot/context.py index 4e12e44a..8892cde1 100644 --- a/src/agents/chatbot/context.py +++ b/src/agents/chatbot/context.py @@ -13,12 +13,16 @@ class Context(BaseContext): default_factory=list, metadata={ "name": "工具", - "options": gen_tool_info(get_tools()), # 这里的选择是所有的工具 + "options": lambda: gen_tool_info(get_tools()), # 这里的选择是所有的工具 "description": "工具列表", }, ) mcps: list[str] = field( default_factory=list, - metadata={"name": "MCP服务器", "options": list(MCP_SERVERS.keys()), "description": "MCP服务器列表"}, + metadata={ + "name": "MCP服务器", + "options": lambda: list(MCP_SERVERS.keys()), + "description": "MCP服务器列表", + }, ) diff --git a/src/agents/common/context.py b/src/agents/common/context.py index 36b3f851..d7d4e35e 100644 --- a/src/agents/common/context.py +++ b/src/agents/common/context.py @@ -107,10 +107,14 @@ class BaseContext: # 提取 Annotated 的元数据 template_metadata = cls._extract_template_metadata(field_type) + options = f.metadata.get("options", []) + if callable(options): + options = options() + configurable_items[f.name] = { "type": type_name, "name": f.metadata.get("name", f.name), - "options": f.metadata.get("options", []), + "options": options, "default": f.default if f.default is not MISSING else f.default_factory() diff --git a/web/src/components/AgentConfigSidebar.vue b/web/src/components/AgentConfigSidebar.vue index fabd44a4..18ac11fa 100644 --- a/web/src/components/AgentConfigSidebar.vue +++ b/web/src/components/AgentConfigSidebar.vue @@ -424,6 +424,10 @@ const getToolNameById = (toolId) => { const openToolsModal = async () => { console.log("availableTools.value", availableTools.value) try { + // 强制刷新智能体详情以获取最新工具列表 + if (selectedAgentId.value) { + await agentStore.fetchAgentDetail(selectedAgentId.value, true); + } selectedTools.value = [...(agentConfig.value?.tools || [])]; toolsModalOpen.value = true; } catch (error) { diff --git a/web/src/stores/agent.js b/web/src/stores/agent.js index 2ea597db..61c92ff6 100644 --- a/web/src/stores/agent.js +++ b/web/src/stores/agent.js @@ -146,11 +146,11 @@ export const useAgentStore = defineStore('agent', () => { * 获取单个智能体的详细信息(包含配置选项) * @param {string} agentId - 智能体ID */ - async function fetchAgentDetail(agentId) { + async function fetchAgentDetail(agentId, forceRefresh = false) { if (!agentId) return - // 如果已经缓存了详细信息,直接返回 - if (agentDetails.value[agentId]) { + // 如果已经缓存了详细信息且不强制刷新,直接返回 + if (!forceRefresh && agentDetails.value[agentId]) { return agentDetails.value[agentId] } From 012e46a76168a1ca23300c4ea4e776e5c92ec01c Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Wed, 24 Dec 2025 20:37:30 +0800 Subject: [PATCH 3/7] =?UTF-8?q?refactor:=20=E7=A7=BB=E9=99=A4=E6=9C=AA?= =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=9A=84=E4=BF=9D=E5=AD=98=E6=80=9D=E7=BB=B4?= =?UTF-8?q?=E5=AF=BC=E5=9B=BE=E5=88=B0=E7=9F=A5=E8=AF=86=E5=BA=93=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/routers/mindmap_router.py | 34 ----------------------- src/storage/db/manager.py | 3 -- web/src/apis/mindmap_api.js | 12 -------- web/src/components/AgentConfigSidebar.vue | 4 --- 4 files changed, 53 deletions(-) diff --git a/server/routers/mindmap_router.py b/server/routers/mindmap_router.py index b68b2d21..91e0d3e6 100644 --- a/server/routers/mindmap_router.py +++ b/server/routers/mindmap_router.py @@ -362,38 +362,4 @@ async def get_database_mindmap(db_id: str, current_user: User = Depends(get_admi raise HTTPException(status_code=500, detail=f"获取思维导图失败: {str(e)}") -@mindmap.post("/database/{db_id}") -async def save_database_mindmap( - db_id: str, - mindmap: dict = Body(..., description="思维导图数据"), - current_user: User = Depends(get_admin_user), -): - """ - 保存思维导图到知识库 - Args: - db_id: 知识库ID - mindmap: 思维导图数据 - - Returns: - 保存结果 - """ - try: - # 检查知识库是否存在 - db_info = knowledge_base.get_database_info(db_id) - if not db_info: - raise HTTPException(status_code=404, detail=f"知识库 {db_id} 不存在") - - # TODO: 将思维导图保存到知识库元数据中 - # 这里需要实现一个方法来更新知识库的元数据 - - return { - "message": "success", - "db_id": db_id, - } - - except HTTPException: - raise - except Exception as e: - logger.error(f"保存思维导图失败: {e}, {traceback.format_exc()}") - raise HTTPException(status_code=500, detail=f"保存思维导图失败: {str(e)}") diff --git a/src/storage/db/manager.py b/src/storage/db/manager.py index 003e4d59..1330c6cd 100644 --- a/src/storage/db/manager.py +++ b/src/storage/db/manager.py @@ -22,9 +22,6 @@ except ImportError: def validate_database_schema(db_path): return True, [] -# TODO:[已完成]为DBManager添加异步支持 -# TODO:[已完成]为DBManager添加单例模式 - class DBManager(metaclass=SingletonMeta): """数据库管理器 - 提供异步数据库连接和会话管理""" diff --git a/web/src/apis/mindmap_api.js b/web/src/apis/mindmap_api.js index 4615485c..f38c7d04 100644 --- a/web/src/apis/mindmap_api.js +++ b/web/src/apis/mindmap_api.js @@ -49,18 +49,6 @@ export const mindmapApi = { */ getByDatabase: async (dbId) => { return apiAdminGet(`/api/mindmap/database/${dbId}`) - }, - - /** - * 保存思维导图到知识库 - * @param {string} dbId - 知识库ID - * @param {Object} mindmapData - 思维导图数据 - * @returns {Promise} - 保存结果 - */ - saveToDatabase: async (dbId, mindmapData) => { - return apiAdminPost(`/api/mindmap/database/${dbId}`, { - mindmap: mindmapData - }) } } diff --git a/web/src/components/AgentConfigSidebar.vue b/web/src/components/AgentConfigSidebar.vue index 18ac11fa..d742ff8e 100644 --- a/web/src/components/AgentConfigSidebar.vue +++ b/web/src/components/AgentConfigSidebar.vue @@ -221,10 +221,6 @@ 保存配置 - - From e8a5844af7d916e690a3ed236466d812c1c780f4 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Wed, 24 Dec 2025 20:37:46 +0800 Subject: [PATCH 4/7] =?UTF-8?q?feat(todo-tools):=20=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=BE=85=E5=8A=9E=E4=BA=8B=E9=A1=B9=E7=BB=93=E6=9E=9C=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E7=BB=84=E4=BB=B6=E5=B9=B6=E4=BC=98=E5=8C=96=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 TodoListResult 组件用于渲染待办事项结果 使用 ant-design 图标替换原有 SVG 图标以保持一致性 优化待办事项状态显示样式 --- web/src/components/AgentPopover.vue | 81 ++++-------- .../ToolCallingResult/TodoListResult.vue | 118 ++++++++++++++++++ .../ToolCallingResult/ToolResultRenderer.vue | 61 +++++++++ 3 files changed, 201 insertions(+), 59 deletions(-) create mode 100644 web/src/components/ToolCallingResult/TodoListResult.vue diff --git a/web/src/components/AgentPopover.vue b/web/src/components/AgentPopover.vue index 0fb8e197..83ea1bca 100644 --- a/web/src/components/AgentPopover.vue +++ b/web/src/components/AgentPopover.vue @@ -39,17 +39,13 @@ :key="index" class="todo-item" > - - - - - - - - - - - +
+ + + + + +
{{ todo.content }} @@ -110,6 +106,13 @@ + + diff --git a/web/src/components/ToolCallingResult/ToolResultRenderer.vue b/web/src/components/ToolCallingResult/ToolResultRenderer.vue index 86a37940..0058622c 100644 --- a/web/src/components/ToolCallingResult/ToolResultRenderer.vue +++ b/web/src/components/ToolCallingResult/ToolResultRenderer.vue @@ -19,6 +19,12 @@ ref="graphResultRef" /> + + + { return props.resultContent }) +const todoListData = computed(() => { + if (props.toolName !== 'write_todos') return [] + + const raw = props.resultContent + + // 1. Try from parsedData (JSON object) + const data = parsedData.value + if (data && typeof data === 'object') { + if (Array.isArray(data)) return data + if (data.todos && Array.isArray(data.todos)) return data.todos + } + + // 2. Try parsing string if it matches specific pattern + if (typeof raw === 'string') { + let str = raw + if (str.startsWith('Updated todo list to ')) { + str = str.replace('Updated todo list to ', '') + } + + // Try regex parsing for Python-like string + const items = [] + // Matches {'content': '...', 'status': '...'} with escaped quotes support + // content might contain escaped quotes + const contentRegex = /'content':\s*'((?:[^'\\]|\\.)*)'/ + const statusRegex = /'status':\s*'((?:[^'\\]|\\.)*)'/ + + // Split by "}, {" roughly, or just look for objects + // Since it is a list of dicts, we can match individual dicts + const dictRegex = /\{.*?\}/g + const dictMatches = str.match(dictRegex) + + if (dictMatches) { + for (const dictStr of dictMatches) { + const contentMatch = dictStr.match(contentRegex) + const statusMatch = dictStr.match(statusRegex) + + if (contentMatch && statusMatch) { + items.push({ + content: contentMatch[1].replace(/\\'/g, "'").replace(/\\\\/g, "\\"), + status: statusMatch[1] + }) + } + } + } + if (items.length > 0) return items + } + + return [] +}) + +const isTodoListResult = computed(() => { + return props.toolName === 'write_todos' && todoListData.value.length > 0 +}) + // 判断是否为网页搜索结果 const isWebSearchResult = computed(() => { const toolNameLower = props.toolName.toLowerCase() From ccc6cbd17a6adfb68f8dbf0b498639d15738afb7 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Wed, 24 Dec 2025 20:59:19 +0800 Subject: [PATCH 5/7] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DSQL=20=E5=B7=A5?= =?UTF-8?q?=E5=85=B7=E9=87=8D=E5=A4=8D=E5=8A=A0=E8=BD=BD=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/agents/chatbot/tools.py | 2 -- src/config/static/info.template.yaml | 6 +++--- web/src/stores/info.js | 6 +++--- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/agents/chatbot/tools.py b/src/agents/chatbot/tools.py index c19d7707..b6eabce6 100644 --- a/src/agents/chatbot/tools.py +++ b/src/agents/chatbot/tools.py @@ -6,7 +6,6 @@ import requests from langchain.tools import tool from src.agents.common import get_buildin_tools -from src.agents.common.toolkits.mysql import get_mysql_tools from src.storage.minio import aupload_file_to_minio from src.utils import logger @@ -52,5 +51,4 @@ def get_tools() -> list[Any]: """获取所有可运行的工具(给大模型使用)""" tools = get_buildin_tools() tools.append(text_to_img_demo) - tools.extend(get_mysql_tools()) return tools diff --git a/src/config/static/info.template.yaml b/src/config/static/info.template.yaml index 8be02cbe..85fb0116 100644 --- a/src/config/static/info.template.yaml +++ b/src/config/static/info.template.yaml @@ -16,15 +16,15 @@ branding: features: - label: "GitHub Stars" - value: "2600+" + value: "3000+" description: "开发者社区的认可与支持" icon: "stars" - label: "已解决 Issues" - value: "210+" + value: "250+" description: "持续改进和问题解决能力" icon: "issues" - label: "累计 Commits" - value: "1000+" + value: "1100+" description: "活跃的开发迭代和功能更新" icon: "commits" - label: "开源协议" diff --git a/web/src/stores/info.js b/web/src/stores/info.js index fade5d61..d4e5e53d 100644 --- a/web/src/stores/info.js +++ b/web/src/stores/info.js @@ -27,17 +27,17 @@ export const useInfoStore = defineStore('info', () => { // 计算属性 - 功能特性 const features = computed(() => infoConfig.value.features || [{ label: "GitHub Stars", - value: "2600+", + value: "3000+", description: "开发者社区的认可与支持", icon: "stars" }, { label: "已解决 Issues", - value: "200+", + value: "250+", description: "持续改进和问题解决能力", icon: "issues" }, { label: "累计 Commits", - value: "1000+", + value: "1100+", description: "活跃的开发迭代和功能更新", icon: "commits" }, { From 2c435782343f23a234b0258f86a67b823376fda7 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Thu, 25 Dec 2025 22:55:54 +0800 Subject: [PATCH 6/7] Revise README layout and add resource links Updated README with new layout and additional links. --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 213a8d82..7fc0854d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -# 语析 - 基于大模型的知识库与知识图谱智能体开发平台 +# 📚 语析 - 基于大模型的知识库与知识图谱智能体开发平台 -
+ +
+ Yuxi-Know | Trendshift [![Stable](https://img.shields.io/badge/stable-v0.3.0-blue.svg)](https://github.com/xerrors/Yuxi-Know/tree/v0.3.0) [![](https://img.shields.io/badge/Docker-2496ED?style=flat&logo=docker&logoColor=ffffff)](https://github.com/xerrors/Yuxi-Know/blob/main/docker-compose.yml) @@ -9,7 +11,11 @@ [![DeepWiki](https://img.shields.io/badge/DeepWiki-blue.svg)](https://deepwiki.com/xerrors/Yuxi-Know) [![zread](https://img.shields.io/badge/Ask_Zread-_.svg?style=flat&color=00b0aa&labelColor=000000&logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQuOTYxNTYgMS42MDAxSDIuMjQxNTZDMS44ODgxIDEuNjAwMSAxLjYwMTU2IDEuODg2NjQgMS42MDE1NiAyLjI0MDFWNC45NjAxQzEuNjAxNTYgNS4zMTM1NiAxLjg4ODEgNS42MDAxIDIuMjQxNTYgNS42MDAxSDQuOTYxNTZDNS4zMTUwMiA1LjYwMDEgNS42MDE1NiA1LjMxMzU2IDUuNjAxNTYgNC45NjAxVjIuMjQwMUM1LjYwMTU2IDEuODg2NjQgNS4zMTUwMiAxLjYwMDEgNC45NjE1NiAxLjYwMDFaIiBmaWxsPSIjZmZmIi8%2BCjxwYXRoIGQ9Ik00Ljk2MTU2IDEwLjM5OTlIMi4yNDE1NkMxLjg4ODEgMTAuMzk5OSAxLjYwMTU2IDEwLjY4NjQgMS42MDE1NiAxMS4wMzk5VjEzLjc1OTlDMS42MDE1NiAxNC4xMTM0IDEuODg4MSAxNC4zOTk5IDIuMjQxNTYgMTQuMzk5OUg0Ljk2MTU2QzUuMzE1MDIgMTQuMzk5OSA1LjYwMTU2IDE0LjExMzQgNS42MDE1NiAxMy43NTk5VjExLjAzOTlDNS42MDE1NiAxMC42ODY0IDUuMzE1MDIgMTAuMzk5OSA0Ljk2MTU2IDEwLjM5OTlaIiBmaWxsPSIjZmZmIi8%2BCjxwYXRoIGQ9Ik0xMy43NTg0IDEuNjAwMUgxMS4wMzg0QzEwLjY4NSAxLjYwMDEgMTAuMzk4NCAxLjg4NjY0IDEwLjM5ODQgMi4yNDAxVjQuOTYwMUMxMC4zOTg0IDUuMzEzNTYgMTAuNjg1IDUuNjAwMSAxMS4wMzg0IDUuNjAwMUgxMy43NTg0QzE0LjExMTkgNS42MDAxIDE0LjM5ODQgNS4zMTM1NiAxNC4zOTg0IDQuOTYwMVYyLjI0MDFDMTQuMzk4NCAxLjg4NjY0IDE0LjExMTkgMS42MDAxIDEzLjc1ODQgMS42MDAxWiIgZmlsbD0iI2ZmZiIvPgo8cGF0aCBkPSJNNCAxMkwxMiA0TDQgMTJaIiBmaWxsPSIjZmZmIi8%2BCjxwYXRoIGQ9Ik00IDEyTDEyIDQiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPgo8L3N2Zz4K&logoColor=ffffff)](https://zread.ai/xerrors/Yuxi-Know) [![demo](https://img.shields.io/badge/demo-00A1D6.svg?style=flat&logo=bilibili&logoColor=white)](https://www.bilibili.com/video/BV1DF14BTETq/) -![](https://img.shields.io/github/stars/xerrors/Yuxi-Know) + +
+ +📄 [**文档中心**](https://xerrors.github.io/Yuxi-Know/) | +📽️ [**视频演示**](https://www.bilibili.com/video/BV1DF14BTETq/)
@@ -20,11 +26,6 @@ image - -> [!tip] -> 详细文档请查看全新的 📄[**文档中心**](https://xerrors.github.io/Yuxi-Know/), -> 哔哩哔哩观看 📽️[**视频演示**](https://www.bilibili.com/video/BV1DF14BTETq/) - --- **🎉 最新动态** From 291d793c9517cde46276bca227f3cb5f4f31f54a Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Fri, 26 Dec 2025 00:51:56 +0800 Subject: [PATCH 7/7] =?UTF-8?q?feat(home):=20=E6=B7=BB=E5=8A=A0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=A6=82=E8=BF=B0=E7=BB=84=E4=BB=B6=E5=B9=B6=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在首页视图中添加 ProjectOverview 组件用于自定义项目介绍,并更新相关文档说明 调整首页布局样式,包括容器高度和间距 --- docs/latest/advanced/branding.md | 6 +++++- web/src/components/ProjectOverview.vue | 2 ++ web/src/views/HomeView.vue | 10 +++++----- 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 web/src/components/ProjectOverview.vue diff --git a/docs/latest/advanced/branding.md b/docs/latest/advanced/branding.md index 84bb38dc..6a841cfc 100644 --- a/docs/latest/advanced/branding.md +++ b/docs/latest/advanced/branding.md @@ -53,4 +53,8 @@ YUXI_BRAND_FILE_PATH=src/config/static/info.local.yaml ``` -**此外**,`web/src/stores/theme.js` 中也包含了主题相关的配置(需要修改 `colorPrimary`),可根据需要修改。 \ No newline at end of file +**此外**,`web/src/stores/theme.js` 中也包含了主题相关的配置(需要修改 `colorPrimary`),可根据需要修改。 + +## 修改首页 + +首页提供了一个插槽组件 `web/src/components/ProjectOverview.vue`,可以在该组件中自定义项目介绍,当前为空文件。(借助 AI 编程可以设计出更好看的首页的) diff --git a/web/src/components/ProjectOverview.vue b/web/src/components/ProjectOverview.vue new file mode 100644 index 00000000..6beff519 --- /dev/null +++ b/web/src/components/ProjectOverview.vue @@ -0,0 +1,2 @@ + diff --git a/web/src/views/HomeView.vue b/web/src/views/HomeView.vue index e839d886..9fced927 100644 --- a/web/src/views/HomeView.vue +++ b/web/src/views/HomeView.vue @@ -75,6 +75,8 @@
+ +