2025-12-27 14:50:32 +08:00
|
|
|
<template>
|
2026-03-26 12:13:51 +08:00
|
|
|
<component
|
|
|
|
|
:is="currentRenderer"
|
|
|
|
|
v-if="currentRenderer"
|
2026-03-04 04:13:05 +08:00
|
|
|
:tool-call="toolCall"
|
2026-03-26 12:13:51 +08:00
|
|
|
ref="toolRendererRef"
|
2026-03-04 04:13:05 +08:00
|
|
|
/>
|
2025-12-27 14:50:32 +08:00
|
|
|
<BaseToolCall v-else :tool-call="toolCall" />
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
2026-01-15 06:01:34 +08:00
|
|
|
import { computed, ref } from 'vue'
|
|
|
|
|
import BaseToolCall from './BaseToolCall.vue'
|
|
|
|
|
|
|
|
|
|
import WebSearchTool from './tools/WebSearchTool.vue'
|
2026-03-04 04:06:48 +08:00
|
|
|
import ListKbsTool from './tools/ListKbsTool.vue'
|
|
|
|
|
import GetMindmapTool from './tools/GetMindmapTool.vue'
|
|
|
|
|
import QueryKbTool from './tools/QueryKbTool.vue'
|
2026-01-15 06:01:34 +08:00
|
|
|
import KnowledgeGraphTool from './tools/KnowledgeGraphTool.vue'
|
|
|
|
|
import CalculatorTool from './tools/CalculatorTool.vue'
|
|
|
|
|
import TodoListTool from './tools/TodoListTool.vue'
|
|
|
|
|
import ImageTool from './tools/ImageTool.vue'
|
|
|
|
|
import WriteFileTool from './tools/WriteFileTool.vue'
|
2026-02-03 14:03:57 +08:00
|
|
|
import ReadFileTool from './tools/ReadFileTool.vue'
|
|
|
|
|
import ListDirectoryTool from './tools/ListDirectoryTool.vue'
|
|
|
|
|
import SearchFileContentTool from './tools/SearchFileContentTool.vue'
|
2026-03-26 12:13:51 +08:00
|
|
|
import GrepTool from './tools/GrepTool.vue'
|
2026-02-03 14:03:57 +08:00
|
|
|
import GlobTool from './tools/GlobTool.vue'
|
|
|
|
|
import EditFileTool from './tools/EditFileTool.vue'
|
2026-02-15 21:57:41 +08:00
|
|
|
import MysqlQueryTool from './tools/MysqlQueryTool.vue'
|
|
|
|
|
import MysqlDescribeTableTool from './tools/MysqlDescribeTableTool.vue'
|
|
|
|
|
import MysqlListTablesTool from './tools/MysqlListTablesTool.vue'
|
2026-03-09 01:23:15 +08:00
|
|
|
import AskUserQuestionTool from './tools/AskUserQuestionTool.vue'
|
2026-03-24 21:48:28 +08:00
|
|
|
import ExecuteTool from './tools/ExecuteTool.vue'
|
2026-03-26 12:13:51 +08:00
|
|
|
import { getToolCallId } from './toolRegistry'
|
2025-12-27 14:50:32 +08:00
|
|
|
|
|
|
|
|
const props = defineProps({
|
|
|
|
|
toolCall: {
|
|
|
|
|
type: Object,
|
|
|
|
|
required: true
|
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
})
|
2025-12-27 14:50:32 +08:00
|
|
|
|
2026-03-26 12:13:51 +08:00
|
|
|
const toolId = computed(() => getToolCallId(props.toolCall))
|
|
|
|
|
|
|
|
|
|
const TOOL_RENDERERS = {
|
|
|
|
|
ask_user_question: AskUserQuestionTool,
|
|
|
|
|
bash: ExecuteTool,
|
|
|
|
|
calculator: CalculatorTool,
|
|
|
|
|
cmd: ExecuteTool,
|
|
|
|
|
edit_file: EditFileTool,
|
|
|
|
|
execute: ExecuteTool,
|
|
|
|
|
get_mindmap: GetMindmapTool,
|
|
|
|
|
glob: GlobTool,
|
|
|
|
|
grep: GrepTool,
|
|
|
|
|
list_directory: ListDirectoryTool,
|
|
|
|
|
list_kbs: ListKbsTool,
|
|
|
|
|
ls: ListDirectoryTool,
|
|
|
|
|
mysql_describe_table: MysqlDescribeTableTool,
|
|
|
|
|
mysql_list_tables: MysqlListTablesTool,
|
|
|
|
|
mysql_query: MysqlQueryTool,
|
|
|
|
|
query_kb: QueryKbTool,
|
|
|
|
|
query_knowledge_graph: KnowledgeGraphTool,
|
|
|
|
|
read_file: ReadFileTool,
|
|
|
|
|
replace: EditFileTool,
|
|
|
|
|
run_shell_command: ExecuteTool,
|
|
|
|
|
search_file_content: SearchFileContentTool,
|
|
|
|
|
tavily_search: WebSearchTool,
|
|
|
|
|
text_to_img_qwen_image: ImageTool,
|
|
|
|
|
write_file: WriteFileTool,
|
|
|
|
|
write_todos: TodoListTool
|
2026-01-15 06:01:34 +08:00
|
|
|
}
|
2025-12-27 14:50:32 +08:00
|
|
|
|
2026-03-26 12:13:51 +08:00
|
|
|
const currentRenderer = computed(() => TOOL_RENDERERS[toolId.value] || null)
|
2025-12-27 14:50:32 +08:00
|
|
|
|
2026-03-26 12:13:51 +08:00
|
|
|
const toolRendererRef = ref(null)
|
2025-12-27 14:50:32 +08:00
|
|
|
const refreshGraph = () => {
|
2026-03-26 12:13:51 +08:00
|
|
|
if (toolRendererRef.value && typeof toolRendererRef.value.refreshGraph === 'function') {
|
|
|
|
|
toolRendererRef.value.refreshGraph()
|
2025-12-27 14:50:32 +08:00
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
}
|
2025-12-27 14:50:32 +08:00
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
defineExpose({ refreshGraph })
|
2025-12-27 14:50:32 +08:00
|
|
|
</script>
|
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
<style lang="less" scoped></style>
|