From 631ca18ce57a7a7cd0e8496962efa72ea16ceeb7 Mon Sep 17 00:00:00 2001 From: WangJing Date: Tue, 29 Jul 2025 15:14:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BD=E9=99=85=E5=8C=96?= =?UTF-8?q?=E6=8E=A7=E4=BB=B6=E6=9C=AA=E6=AD=A3=E7=A1=AE=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chatweb/components/ChatBox.vue | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/chat-client/src/views/chatweb/components/ChatBox.vue b/chat-client/src/views/chatweb/components/ChatBox.vue index 2116a55..28c6dcb 100644 --- a/chat-client/src/views/chatweb/components/ChatBox.vue +++ b/chat-client/src/views/chatweb/components/ChatBox.vue @@ -3,7 +3,7 @@
@@ -24,7 +24,7 @@ :class="{ 'active': currentChatIndex === index }" @click="switchChat(index)" > - {{ chat.title || $t('vabI18n.chat.chat') + ` ${index + 1}` }} + {{ chat.title || t('vabI18n.chat.chat') + ` ${index + 1}` }} {{ formatTime(chat.timestamp) }}
@@ -51,14 +51,14 @@ - {{ $t('vabI18n.chat.assistant') }} +
- {{ msg.isUser ? $t('vabI18n.chat.you') : $t('vabI18n.chat.assistant') }} + {{ msg.isUser ? t('vabI18n.chat.you') : t('vabI18n.chat.assistant') }}
@@ -70,7 +70,7 @@ type="textarea" :autosize="{ minRows: 3, maxRows: 8 }" class="edit-textarea" - placeholder="{{ $t('vabI18n.chat.placeholder') }}" + :placeholder="$t('vabI18n.chat.placeholder')" @keydown.enter.ctrl="handleSaveEdit" @keydown.escape="handleCancelEdit" /> @@ -79,14 +79,14 @@ @click="handleCancelEdit" class="edit-btn cancel-btn" > - {{ $t('vabI18n.chat.cancel') }} + {{ t('vabI18n.chat.cancel') }}
@@ -101,7 +101,7 @@ - {{ $t('vabI18n.chat.think') }} + {{ t('vabI18n.chat.think') }}
{{ parseThink(msg.text).think }} @@ -137,7 +137,7 @@ - {{ $t('vabI18n.chat.sources') }} + {{ t('vabI18n.chat.sources') }}
@@ -324,7 +324,7 @@
@@ -332,7 +332,7 @@ @@ -352,7 +352,7 @@ { // 获取文件类型图标 - 使用动态导入确保路径正确 const getFileTypeIcon = (fileType: string) => { - // 使用动态导入获取图标路径 + const icons = require.context('@/assets/img/filetype-icon', false, /\.png$/) + // console.log(icons) + // console.log('所有图标 keys:', icons.keys()) + const getIconUrl = (iconName: string) => { - return new URL(require(`@/assets/img/filetype-icon/${iconName}.png`), import.meta.url).href + const fullName = `./${iconName}.png` + if (icons.keys().includes(fullName)) { + return icons(fullName) + } else { + // console.warn('图标不存在:', fullName) + return '' + } } const iconMap: Record = {