From 95dd500a16eae55ded7593c6752ee775041ead79 Mon Sep 17 00:00:00 2001 From: matevip Date: Thu, 23 Apr 2026 08:09:37 +0800 Subject: [PATCH] feat(ui): localize tool call display via useToolLabel --- mateclaw-ui/src/components/chat/ChatInput.vue | 4 +- .../src/components/chat/MessageBubble.vue | 10 ++- .../src/components/chat/ToolCallSegment.vue | 5 +- mateclaw-ui/src/composables/useToolLabel.ts | 43 +++++++++++ mateclaw-ui/src/i18n/locales/en-US.ts | 75 +++++++++++++++++++ mateclaw-ui/src/i18n/locales/zh-CN.ts | 75 +++++++++++++++++++ 6 files changed, 206 insertions(+), 6 deletions(-) create mode 100644 mateclaw-ui/src/composables/useToolLabel.ts diff --git a/mateclaw-ui/src/components/chat/ChatInput.vue b/mateclaw-ui/src/components/chat/ChatInput.vue index c4515808..6ae1059c 100644 --- a/mateclaw-ui/src/components/chat/ChatInput.vue +++ b/mateclaw-ui/src/components/chat/ChatInput.vue @@ -64,7 +64,7 @@ {{ t('chat.approvalAllow') }} - {{ pendingApproval.toolName }} + {{ getToolLabel(pendingApproval.toolName) }} {{ t('chat.approvalExecute') }}
@@ -203,6 +203,7 @@ import { ref, computed, nextTick, watch } from 'vue' import { useI18n } from 'vue-i18n' import { CloseBold, MagicStick, Microphone, Paperclip, Promotion, Select, Timer, WarningFilled } from '@element-plus/icons-vue' +import { useToolLabel } from '@/composables/useToolLabel' import type { ChatAttachment, PendingApprovalMeta, StreamPhase, QueuedMessage } from '@/types' interface Props { @@ -272,6 +273,7 @@ const emit = defineEmits<{ }>() const { t } = useI18n() +const { getToolLabel } = useToolLabel() // 内部状态 const containerRef = ref(null) diff --git a/mateclaw-ui/src/components/chat/MessageBubble.vue b/mateclaw-ui/src/components/chat/MessageBubble.vue index 62c2d3e9..0eb470fc 100644 --- a/mateclaw-ui/src/components/chat/MessageBubble.vue +++ b/mateclaw-ui/src/components/chat/MessageBubble.vue @@ -89,7 +89,7 @@