From 0d87c1755eaa1f81139373af4d78af9aa1a781b1 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Sun, 28 Dec 2025 01:00:12 +0800 Subject: [PATCH] =?UTF-8?q?feat(tool-calling):=20=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E8=B0=83=E7=94=A8=E7=BB=93=E6=9E=9C=E7=9A=84?= =?UTF-8?q?=E5=A4=B4=E9=83=A8=E6=A0=B7=E5=BC=8F=E5=B9=B6=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=86=99=E6=96=87=E4=BB=B6=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 为WebSearchTool、KnowledgeGraphTool、TodoListTool和TaskTool添加统一的sep-header样式 - 新增WriteFileTool组件用于显示写文件工具调用结果 - 在ToolCallRenderer中集成WriteFileTool组件 - 在BaseToolCall中定义统一的sep-header样式 --- .../ToolCallingResult/BaseToolCall.vue | 31 +++++++++ .../ToolCallingResult/ToolCallRenderer.vue | 8 +++ web/src/components/ToolCallingResult/index.js | 3 +- .../tools/KnowledgeGraphTool.vue | 27 +++++++- .../ToolCallingResult/tools/TaskTool.vue | 17 +---- .../ToolCallingResult/tools/TodoListTool.vue | 66 ++++++++++++------- .../ToolCallingResult/tools/WebSearchTool.vue | 7 +- .../ToolCallingResult/tools/WriteFileTool.vue | 50 ++++++++++++++ 8 files changed, 168 insertions(+), 41 deletions(-) create mode 100644 web/src/components/ToolCallingResult/tools/WriteFileTool.vue diff --git a/web/src/components/ToolCallingResult/BaseToolCall.vue b/web/src/components/ToolCallingResult/BaseToolCall.vue index 0a911f08..cd69805f 100644 --- a/web/src/components/ToolCallingResult/BaseToolCall.vue +++ b/web/src/components/ToolCallingResult/BaseToolCall.vue @@ -273,12 +273,43 @@ const formatResultData = (data) => { white-space: nowrap; text-overflow: ellipsis; + + :deep(.sep-header) { + display: flex; + align-items: center; + gap: 8px; + font-size: 14px; + width: 100%; + overflow: hidden; + } + :deep(.keywords) { color: var(--main-700); font-weight: 600; font-size: 14px; } + :deep(.note) { + font-weight: 600; + color: var(--main-700); + white-space: nowrap; + flex-shrink: 0; + } + + :deep(.separator) { + color: var(--gray-300); + flex-shrink: 0; + } + + :deep(.description) { + color: var(--gray-600); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + min-width: 0; + flex: 1; + } + :deep(.tag) { font-size: 12px; color: var(--gray-600); diff --git a/web/src/components/ToolCallingResult/ToolCallRenderer.vue b/web/src/components/ToolCallingResult/ToolCallRenderer.vue index f1a99c7d..717bb254 100644 --- a/web/src/components/ToolCallingResult/ToolCallRenderer.vue +++ b/web/src/components/ToolCallingResult/ToolCallRenderer.vue @@ -24,6 +24,9 @@ + + + @@ -40,6 +43,7 @@ import CalculatorTool from './tools/CalculatorTool.vue'; import TodoListTool from './tools/TodoListTool.vue'; import ImageTool from './tools/ImageTool.vue'; import TaskTool from './tools/TaskTool.vue'; +import WriteFileTool from './tools/WriteFileTool.vue'; const props = defineProps({ toolCall: { @@ -121,6 +125,10 @@ const isImageResult = computed(() => { return data && typeof data === 'string' && data.startsWith('http'); }); +const isWriteFileResult = computed(() => { + return toolName.value === 'write_file'; +}); + // 处理知识图谱刷新 const graphToolCallRef = ref(null); const refreshGraph = () => { diff --git a/web/src/components/ToolCallingResult/index.js b/web/src/components/ToolCallingResult/index.js index 5b934ac7..cc24dd17 100644 --- a/web/src/components/ToolCallingResult/index.js +++ b/web/src/components/ToolCallingResult/index.js @@ -8,4 +8,5 @@ export { default as KnowledgeBaseTool } from './tools/KnowledgeBaseTool.vue' export { default as KnowledgeGraphTool } from './tools/KnowledgeGraphTool.vue' export { default as CalculatorTool } from './tools/CalculatorTool.vue' export { default as TodoListTool } from './tools/TodoListTool.vue' -export { default as ImageTool } from './tools/ImageTool.vue' \ No newline at end of file +export { default as ImageTool } from './tools/ImageTool.vue' +export { default as WriteFileTool } from './tools/WriteFileTool.vue' \ No newline at end of file diff --git a/web/src/components/ToolCallingResult/tools/KnowledgeGraphTool.vue b/web/src/components/ToolCallingResult/tools/KnowledgeGraphTool.vue index 9a2779cc..c1cc35c1 100644 --- a/web/src/components/ToolCallingResult/tools/KnowledgeGraphTool.vue +++ b/web/src/components/ToolCallingResult/tools/KnowledgeGraphTool.vue @@ -1,5 +1,12 @@