fix: chat issue

This commit is contained in:
wangdan-fit2cloud 2025-07-16 18:40:20 +08:00
parent ca6630f258
commit fa55cdc143
6 changed files with 51 additions and 26 deletions

View File

@ -271,11 +271,15 @@
<el-button <el-button
text text
class="sent-button" class="sent-button"
:disabled="isDisabledChat || loading" :disabled="isDisabledChat || loading || !uploadLoading"
@click="sendChatHandle" @click="sendChatHandle"
> >
<img v-show="isDisabledChat || loading" src="@/assets/icon_send.svg" alt="" /> <img
<SendIcon v-show="!isDisabledChat && !loading" /> v-show="isDisabledChat || loading || uploadLoading"
src="@/assets/icon_send.svg"
alt=""
/>
<SendIcon v-show="!isDisabledChat && !loading && !uploadLoading" />
</el-button> </el-button>
</template> </template>
</div> </div>
@ -777,7 +781,7 @@ function sendChatHandle(event?: any) {
if (!event?.ctrlKey && !event?.shiftKey && !event?.altKey && !event?.metaKey) { if (!event?.ctrlKey && !event?.shiftKey && !event?.altKey && !event?.metaKey) {
// //
event?.preventDefault() event?.preventDefault()
if (!isDisabledChat.value && !props.loading && !event?.isComposing) { if (!isDisabledChat.value && !props.loading && !event?.isComposing && !uploadLoading.value) {
if (inputValue.value.trim()) { if (inputValue.value.trim()) {
autoSendMessage() autoSendMessage()
} }

View File

@ -3,7 +3,7 @@
shadow="never" shadow="never"
:title="index + 1 + '.' + data.title || '-'" :title="index + 1 + '.' + data.title || '-'"
class="paragraph-source-card cursor mb-8 paragraph-source-card-height" class="paragraph-source-card cursor mb-8 paragraph-source-card-height"
:style="{ 'height': data?.document_name?.trim() ? '300px' : '260px' }" :style="{ height: data?.document_name?.trim() ? '300px' : '260px' }"
:class="data.is_active ? '' : 'disabled'" :class="data.is_active ? '' : 'disabled'"
:showIcon="false" :showIcon="false"
> >
@ -26,22 +26,23 @@
> >
<el-text class="flex align-center item"> <el-text class="flex align-center item">
<img :src="getImgUrl(data?.document_name?.trim())" alt="" width="20" class="mr-4" /> <img :src="getImgUrl(data?.document_name?.trim())" alt="" width="20" class="mr-4" />
<div class="ml-8">
<template v-if="meta?.source_url"> <div class="ml-4" v-if="data?.meta?.source_file_id || data?.meta?.source_url">
<a <a
:href="getNormalizedUrl(meta?.source_url)" :href="getFileUrl(data?.meta?.source_file_id) || data?.meta?.source_url"
target="_blank" target="_blank"
class="ellipsis-1 break-all" class="ellipsis-1"
:title="data?.document_name?.trim()" :title="data?.document_name?.trim()"
> >
{{ data?.document_name?.trim() }} <span :title="data?.document_name?.trim()">{{ data?.document_name }}</span>
</a> </a>
</template> </div>
<template v-else> <div v-else @click="infoMessage">
<span class="ellipsis-1 break-all" :title="data?.document_name?.trim()"> <span class="ellipsis-1 break-all" :title="data?.document_name?.trim()">
{{ data?.document_name?.trim() }} {{ data?.document_name?.trim() }}
</span> </span>
</template> </div>
</div>
</el-text> </el-text>
</el-card> </el-card>
<div class="flex align-center border-t" style="padding: 12px 0 8px"> <div class="flex align-center border-t" style="padding: 12px 0 8px">
@ -54,9 +55,10 @@
</CardBox> </CardBox>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { getImgUrl, getNormalizedUrl } from '@/utils/common' import { getImgUrl, getFileUrl } from '@/utils/common'
import { computed } from 'vue' import { computed } from 'vue'
import { MsgInfo } from '@/utils/message'
import { t } from '@/locales'
const props = defineProps({ const props = defineProps({
data: { data: {
type: Object, type: Object,
@ -85,6 +87,9 @@ const parsedMeta = computed(() => {
}) })
const meta = computed(() => (isMetaObject.value ? props.data.meta : parsedMeta.value)) const meta = computed(() => (isMetaObject.value ? props.data.meta : parsedMeta.value))
function infoMessage() {
MsgInfo(t('chat.noDocument'))
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
// .paragraph-source-card-height { // .paragraph-source-card-height {

View File

@ -32,7 +32,10 @@
> >
<p>{{ item && item?.document_name }}</p> <p>{{ item && item?.document_name }}</p>
</div> </div>
<div class="ml-8" v-else> <div
class="ml-4"
v-else-if="item?.meta?.source_file_id || item?.meta?.source_url"
>
<a <a
:href="getFileUrl(item?.meta?.source_file_id) || item?.meta?.source_url" :href="getFileUrl(item?.meta?.source_file_id) || item?.meta?.source_url"
target="_blank" target="_blank"
@ -42,6 +45,11 @@
<span :title="item?.document_name?.trim()">{{ item?.document_name }}</span> <span :title="item?.document_name?.trim()">{{ item?.document_name }}</span>
</a> </a>
</div> </div>
<div v-else @click="infoMessage">
<span class="ellipsis-1 break-all" :title="data?.document_name?.trim()">
{{ data?.document_name?.trim() }}
</span>
</div>
</div> </div>
</div> </div>
</el-card> </el-card>
@ -121,6 +129,7 @@ import ParagraphSourceContent from './ParagraphSourceContent.vue'
import { arraySort } from '@/utils/array' import { arraySort } from '@/utils/array'
import { getImgUrl, getFileUrl } from '@/utils/common' import { getImgUrl, getFileUrl } from '@/utils/common'
import { t } from '@/locales' import { t } from '@/locales'
import { MsgInfo } from '@/utils/message'
const props = defineProps({ const props = defineProps({
data: { data: {
type: Object, type: Object,
@ -157,6 +166,10 @@ const dialogTitle = ref('')
const currentComponent = shallowRef<any>(null) const currentComponent = shallowRef<any>(null)
const currentChatDetail = ref<any>(null) const currentChatDetail = ref<any>(null)
const dialogType = ref('') const dialogType = ref('')
function infoMessage() {
MsgInfo(t('chat.noDocument'))
}
function openParagraph(row: any, id?: string) { function openParagraph(row: any, id?: string) {
dialogTitle.value = t('chat.KnowledgeSource.title') dialogTitle.value = t('chat.KnowledgeSource.title')
const obj = cloneDeep(row) const obj = cloneDeep(row)

View File

@ -13,6 +13,7 @@ export default {
userInput: 'User Input', userInput: 'User Input',
quote: 'Quote', quote: 'Quote',
download: 'Click to Download', download: 'Click to Download',
noDocument: 'Original Document Not Found',
passwordValidator: { passwordValidator: {
title: 'Enter Password to Access', title: 'Enter Password to Access',
errorMessage1: 'Password cannot be empty', errorMessage1: 'Password cannot be empty',

View File

@ -17,6 +17,7 @@ export default {
quote: '引用', quote: '引用',
download: '点击下载文件', download: '点击下载文件',
transcribing: '转文字中', transcribing: '转文字中',
noDocument: '原文档不存在',
passwordValidator: { passwordValidator: {
title: '请输入密码打开链接', title: '请输入密码打开链接',
errorMessage1: '密码不能为空', errorMessage1: '密码不能为空',
@ -94,7 +95,7 @@ export default {
referenceParagraph: '引用分段', referenceParagraph: '引用分段',
consume: '消耗tokens', consume: '消耗tokens',
consumeTime: '耗时', consumeTime: '耗时',
noSource: '没有检索到知识来源' noSource: '没有检索到知识来源',
}, },
paragraphSource: { paragraphSource: {
title: '知识库引用', title: '知识库引用',

View File

@ -13,6 +13,7 @@ export default {
userInput: '用戶輸入', userInput: '用戶輸入',
quote: '引用', quote: '引用',
download: '點擊下載文件', download: '點擊下載文件',
noDocument: '原文檔不存在',
passwordValidator: { passwordValidator: {
title: '請輸入密碼打開連結', title: '請輸入密碼打開連結',
errorMessage1: '密碼不能為空', errorMessage1: '密碼不能為空',
@ -101,7 +102,7 @@ export default {
historyRecord: '歷史記錄', historyRecord: '歷史記錄',
currentChat: '本次對話', currentChat: '本次對話',
AiResponse: 'AI 回答', AiResponse: 'AI 回答',
knowedMessage: '已知資訊' knowedMessage: '已知資訊',
}, },
editTitle: '編輯標題', editTitle: '編輯標題',
} }