Merge remote-tracking branch 'origin/main'
This commit is contained in:
commit
7a8413cf38
|
@ -3,7 +3,7 @@
|
|||
<!-- 会话记录侧边栏 -->
|
||||
<div class="chat-sidebar" :class="{ 'sidebar-collapsed': isSidebarCollapsed }">
|
||||
<div class="sidebar-header">
|
||||
<h3 v-show="!isSidebarCollapsed">{{ $t('vabI18n.chat.history') }}</h3>
|
||||
<h3 v-show="!isSidebarCollapsed">{{ t('vabI18n.chat.history') }}</h3>
|
||||
<el-button
|
||||
type="primary"
|
||||
class="new-chat-btn"
|
||||
|
@ -13,7 +13,7 @@
|
|||
<svg viewBox="0 0 24 24" class="new-chat-icon">
|
||||
<path fill="currentColor" d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
|
||||
</svg>
|
||||
{{ $t('vabI18n.chat.newChat') }}
|
||||
{{ t('vabI18n.chat.newChat') }}
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="chat-history" v-show="!isSidebarCollapsed">
|
||||
|
@ -24,7 +24,7 @@
|
|||
:class="{ 'active': currentChatIndex === index }"
|
||||
@click="switchChat(index)"
|
||||
>
|
||||
<span class="chat-title">{{ chat.title || $t('vabI18n.chat.chat') + ` ${index + 1}` }}</span>
|
||||
<span class="chat-title">{{ chat.title || t('vabI18n.chat.chat') + ` ${index + 1}` }}</span>
|
||||
<span class="chat-time">{{ formatTime(chat.timestamp) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -51,14 +51,14 @@
|
|||
<svg v-if="msg.isUser" viewBox="0 0 24 24" class="avatar-icon">
|
||||
<path fill="currentColor" d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/>
|
||||
</svg>
|
||||
<img v-else :src="getAssistantAvatar()" alt="{{ $t('vabI18n.chat.assistant') }}" class="avatar-icon" />
|
||||
<img v-else :src="getAssistantAvatar()" :alt="$t('vabI18n.chat.assistant')" class="avatar-icon" />
|
||||
</div>
|
||||
|
||||
<!-- 消息内容 -->
|
||||
<div class="message-content-wrapper" :class="{ 'has-charts': !msg.isUser && msg.echarts && msg.echarts.length > 0 }">
|
||||
<div class="message-content">
|
||||
<div class="message-header">
|
||||
<span class="message-sender">{{ msg.isUser ? $t('vabI18n.chat.you') : $t('vabI18n.chat.assistant') }}</span>
|
||||
<span class="message-sender">{{ msg.isUser ? t('vabI18n.chat.you') : t('vabI18n.chat.assistant') }}</span>
|
||||
</div>
|
||||
<div class="message-body">
|
||||
<!-- 编辑状态 -->
|
||||
|
@ -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') }}
|
||||
</button>
|
||||
<button
|
||||
@click="handleSaveEdit"
|
||||
:disabled="!editingMessageText.trim()"
|
||||
class="edit-btn save-btn"
|
||||
>
|
||||
{{ $t('vabI18n.chat.send') }}
|
||||
{{ t('vabI18n.chat.send') }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -101,7 +101,7 @@
|
|||
<svg viewBox="0 0 24 24" class="think-icon">
|
||||
<path fill="currentColor" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/>
|
||||
</svg>
|
||||
{{ $t('vabI18n.chat.think') }}
|
||||
{{ t('vabI18n.chat.think') }}
|
||||
</div>
|
||||
{{ parseThink(msg.text).think }}
|
||||
</div>
|
||||
|
@ -137,7 +137,7 @@
|
|||
<svg viewBox="0 0 24 24" class="sources-icon">
|
||||
<path fill="currentColor" d="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z"/>
|
||||
</svg>
|
||||
{{ $t('vabI18n.chat.sources') }}
|
||||
{{ t('vabI18n.chat.sources') }}
|
||||
</div>
|
||||
<div class="sources-list">
|
||||
<!-- PDF文件来源 -->
|
||||
|
@ -324,7 +324,7 @@
|
|||
</el-button>
|
||||
</div>
|
||||
<div class="input-footer">
|
||||
<span class="footer-hint">{{ $t('vabI18n.chat.sendHint') }}</span>
|
||||
<span class="footer-hint">{{ t('vabI18n.chat.sendHint') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -332,7 +332,7 @@
|
|||
<!-- 文件预览模态框 -->
|
||||
<el-dialog
|
||||
v-model="filePreviewVisible"
|
||||
title="{{ $t('chat.previewTitle') }}"
|
||||
:title="t('vabI18n.chat.previewTitle')"
|
||||
width="80%"
|
||||
class="file-preview-dialog"
|
||||
:close-on-click-modal="false"
|
||||
|
@ -343,7 +343,7 @@
|
|||
v-if="previewFileUrl"
|
||||
:src="previewFileUrl"
|
||||
@rendered="() => { previewLoading = false }"
|
||||
@error="() => { previewLoading = false; ElMessage.error($t('vabI18n.chat.previewTitleFail')) }"
|
||||
@error="() => { previewLoading = false; ElMessage.error(t('vabI18n.chat.previewTitleFail')) }"
|
||||
class="pdf-preview"
|
||||
/>
|
||||
</div>
|
||||
|
@ -352,7 +352,7 @@
|
|||
<!-- Excel表格预览模态框 -->
|
||||
<el-dialog
|
||||
v-model="excelPreviewVisible"
|
||||
title="{$t('vabI18n.chat.excelPreviewTitle')}"
|
||||
:title="$t('vabI18n.chat.excelPreviewTitle')"
|
||||
width="90%"
|
||||
class="excel-preview-dialog"
|
||||
:close-on-click-modal="false"
|
||||
|
@ -905,9 +905,18 @@ const parseThink = (text: string) => {
|
|||
|
||||
// 获取文件类型图标 - 使用动态导入确保路径正确
|
||||
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<string, string> = {
|
||||
|
|
|
@ -394,14 +394,19 @@ interface PdfTask {
|
|||
}
|
||||
|
||||
const getFileTypeIcon = (fileType: string) => {
|
||||
// 使用动态导入获取图标路径
|
||||
// const getIconUrl = (iconName: string) => {
|
||||
// return new URL(require(`@/assets/img/filetype-icon/${iconName}.png`), import.meta.url).href
|
||||
// }
|
||||
const getIconUrl = (iconName: string) => {
|
||||
return new URL(`/src/assets/img/filetype-icon/${iconName}.png`, import.meta.url).href
|
||||
}
|
||||
const icons = require.context('@/assets/img/filetype-icon', false, /\.png$/)
|
||||
// console.log(icons)
|
||||
// console.log('所有图标 keys:', icons.keys())
|
||||
|
||||
const getIconUrl = (iconName: string) => {
|
||||
const fullName = `./${iconName}.png`
|
||||
if (icons.keys().includes(fullName)) {
|
||||
return icons(fullName)
|
||||
} else {
|
||||
// console.warn('图标不存在:', fullName)
|
||||
return ''
|
||||
}
|
||||
}
|
||||
|
||||
const iconMap: Record<string, string> = {
|
||||
'pdf': getIconUrl('pdf'),
|
||||
|
|
Loading…
Reference in New Issue