From d1f4d850f5c63cbef3be794c399dd5b45e2a2951 Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Sun, 22 Jun 2025 23:08:40 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E8=B0=83=E7=94=A8=E7=BB=93=E6=9E=9C=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 AgentMessageComponent.vue 中优化工具参数和结果展示。 - 新增 CalculatorResult、KnowledgeBaseResult、KnowledgeGraphResult、WebSearchResult 和 ToolResultRenderer 组件,支持不同类型的工具调用结果展示。 - 添加工具调用结果的样式和逻辑处理。 --- web/src/components/AgentMessageComponent.vue | 35 ++- .../ToolCallingResult/CalculatorResult.vue | 212 ++++++++++++++ .../ToolCallingResult/KnowledgeBaseResult.vue | 232 +++++++++++++++ .../KnowledgeGraphResult.vue | 272 ++++++++++++++++++ .../ToolCallingResult/ToolResultRenderer.vue | 198 +++++++++++++ .../ToolCallingResult/WebSearchResult.vue | 188 ++++++++++++ web/src/components/ToolCallingResult/index.js | 6 + 7 files changed, 1135 insertions(+), 8 deletions(-) create mode 100644 web/src/components/ToolCallingResult/CalculatorResult.vue create mode 100644 web/src/components/ToolCallingResult/KnowledgeBaseResult.vue create mode 100644 web/src/components/ToolCallingResult/KnowledgeGraphResult.vue create mode 100644 web/src/components/ToolCallingResult/ToolResultRenderer.vue create mode 100644 web/src/components/ToolCallingResult/WebSearchResult.vue create mode 100644 web/src/components/ToolCallingResult/index.js diff --git a/web/src/components/AgentMessageComponent.vue b/web/src/components/AgentMessageComponent.vue index e2853639..1d580f86 100644 --- a/web/src/components/AgentMessageComponent.vue +++ b/web/src/components/AgentMessageComponent.vue @@ -43,18 +43,17 @@
-
- 参数: -
-
{{ toolCall.args || toolCall.function.arguments }}
+
 参数: {{ toolCall.args || toolCall.function.arguments }}
-
-
- 执行结果 +
+
+
-
{{ toolCall.tool_call_result.content }}
@@ -84,6 +83,7 @@ import { computed, ref } from 'vue'; import { CaretRightOutlined, ThunderboltOutlined, LoadingOutlined } from '@ant-design/icons-vue'; import RefsComponent from '@/components/RefsComponent.vue' +import { ToolResultRenderer } from '@/components/ToolCallingResult' import { MdPreview } from 'md-editor-v3' @@ -309,6 +309,25 @@ const toggleToolCall = (toolCallId) => { } } } + + .tool-result { + padding: 0; + background-color: transparent; + + .tool-result-header { + padding: 10px 12px; + background-color: var(--gray-100); + font-size: 12px; + color: var(--gray-700); + font-weight: 500; + border-bottom: 1px solid var(--gray-200); + } + + .tool-result-content { + padding: 0; + background-color: transparent; + } + } } &.is-collapsed { diff --git a/web/src/components/ToolCallingResult/CalculatorResult.vue b/web/src/components/ToolCallingResult/CalculatorResult.vue new file mode 100644 index 00000000..81a346ce --- /dev/null +++ b/web/src/components/ToolCallingResult/CalculatorResult.vue @@ -0,0 +1,212 @@ + + + + + \ No newline at end of file diff --git a/web/src/components/ToolCallingResult/KnowledgeBaseResult.vue b/web/src/components/ToolCallingResult/KnowledgeBaseResult.vue new file mode 100644 index 00000000..f8a986cd --- /dev/null +++ b/web/src/components/ToolCallingResult/KnowledgeBaseResult.vue @@ -0,0 +1,232 @@ + + + + + \ No newline at end of file diff --git a/web/src/components/ToolCallingResult/KnowledgeGraphResult.vue b/web/src/components/ToolCallingResult/KnowledgeGraphResult.vue new file mode 100644 index 00000000..8389fad2 --- /dev/null +++ b/web/src/components/ToolCallingResult/KnowledgeGraphResult.vue @@ -0,0 +1,272 @@ + + + + + \ No newline at end of file diff --git a/web/src/components/ToolCallingResult/ToolResultRenderer.vue b/web/src/components/ToolCallingResult/ToolResultRenderer.vue new file mode 100644 index 00000000..d30e257e --- /dev/null +++ b/web/src/components/ToolCallingResult/ToolResultRenderer.vue @@ -0,0 +1,198 @@ + + + + + \ No newline at end of file diff --git a/web/src/components/ToolCallingResult/WebSearchResult.vue b/web/src/components/ToolCallingResult/WebSearchResult.vue new file mode 100644 index 00000000..03f86b81 --- /dev/null +++ b/web/src/components/ToolCallingResult/WebSearchResult.vue @@ -0,0 +1,188 @@ + + + + + \ No newline at end of file diff --git a/web/src/components/ToolCallingResult/index.js b/web/src/components/ToolCallingResult/index.js new file mode 100644 index 00000000..471d4bdf --- /dev/null +++ b/web/src/components/ToolCallingResult/index.js @@ -0,0 +1,6 @@ +// 工具调用结果组件导出 +export { default as WebSearchResult } from './WebSearchResult.vue' +export { default as KnowledgeBaseResult } from './KnowledgeBaseResult.vue' +export { default as KnowledgeGraphResult } from './KnowledgeGraphResult.vue' +export { default as CalculatorResult } from './CalculatorResult.vue' +export { default as ToolResultRenderer } from './ToolResultRenderer.vue' \ No newline at end of file