mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
fix: chat issue
This commit is contained in:
parent
ca6630f258
commit
fa55cdc143
|
|
@ -271,11 +271,15 @@
|
|||
<el-button
|
||||
text
|
||||
class="sent-button"
|
||||
:disabled="isDisabledChat || loading"
|
||||
:disabled="isDisabledChat || loading || !uploadLoading"
|
||||
@click="sendChatHandle"
|
||||
>
|
||||
<img v-show="isDisabledChat || loading" src="@/assets/icon_send.svg" alt="" />
|
||||
<SendIcon v-show="!isDisabledChat && !loading" />
|
||||
<img
|
||||
v-show="isDisabledChat || loading || uploadLoading"
|
||||
src="@/assets/icon_send.svg"
|
||||
alt=""
|
||||
/>
|
||||
<SendIcon v-show="!isDisabledChat && !loading && !uploadLoading" />
|
||||
</el-button>
|
||||
</template>
|
||||
</div>
|
||||
|
|
@ -777,7 +781,7 @@ function sendChatHandle(event?: any) {
|
|||
if (!event?.ctrlKey && !event?.shiftKey && !event?.altKey && !event?.metaKey) {
|
||||
// 如果没有按下组合键,则会阻止默认事件
|
||||
event?.preventDefault()
|
||||
if (!isDisabledChat.value && !props.loading && !event?.isComposing) {
|
||||
if (!isDisabledChat.value && !props.loading && !event?.isComposing && !uploadLoading.value) {
|
||||
if (inputValue.value.trim()) {
|
||||
autoSendMessage()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
shadow="never"
|
||||
:title="index + 1 + '.' + data.title || '-'"
|
||||
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'"
|
||||
:showIcon="false"
|
||||
>
|
||||
|
|
@ -26,22 +26,23 @@
|
|||
>
|
||||
<el-text class="flex align-center item">
|
||||
<img :src="getImgUrl(data?.document_name?.trim())" alt="" width="20" class="mr-4" />
|
||||
|
||||
<template v-if="meta?.source_url">
|
||||
<a
|
||||
:href="getNormalizedUrl(meta?.source_url)"
|
||||
target="_blank"
|
||||
class="ellipsis-1 break-all"
|
||||
:title="data?.document_name?.trim()"
|
||||
>
|
||||
{{ data?.document_name?.trim() }}
|
||||
</a>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span class="ellipsis-1 break-all" :title="data?.document_name?.trim()">
|
||||
{{ data?.document_name?.trim() }}
|
||||
</span>
|
||||
</template>
|
||||
<div class="ml-8">
|
||||
<div class="ml-4" v-if="data?.meta?.source_file_id || data?.meta?.source_url">
|
||||
<a
|
||||
:href="getFileUrl(data?.meta?.source_file_id) || data?.meta?.source_url"
|
||||
target="_blank"
|
||||
class="ellipsis-1"
|
||||
:title="data?.document_name?.trim()"
|
||||
>
|
||||
<span :title="data?.document_name?.trim()">{{ data?.document_name }}</span>
|
||||
</a>
|
||||
</div>
|
||||
<div v-else @click="infoMessage">
|
||||
<span class="ellipsis-1 break-all" :title="data?.document_name?.trim()">
|
||||
{{ data?.document_name?.trim() }}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</el-text>
|
||||
</el-card>
|
||||
<div class="flex align-center border-t" style="padding: 12px 0 8px">
|
||||
|
|
@ -54,9 +55,10 @@
|
|||
</CardBox>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { getImgUrl, getNormalizedUrl } from '@/utils/common'
|
||||
import { getImgUrl, getFileUrl } from '@/utils/common'
|
||||
import { computed } from 'vue'
|
||||
|
||||
import { MsgInfo } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
|
|
@ -85,6 +87,9 @@ const parsedMeta = computed(() => {
|
|||
})
|
||||
|
||||
const meta = computed(() => (isMetaObject.value ? props.data.meta : parsedMeta.value))
|
||||
function infoMessage() {
|
||||
MsgInfo(t('chat.noDocument'))
|
||||
}
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
// .paragraph-source-card-height {
|
||||
|
|
|
|||
|
|
@ -32,7 +32,10 @@
|
|||
>
|
||||
<p>{{ item && item?.document_name }}</p>
|
||||
</div>
|
||||
<div class="ml-8" v-else>
|
||||
<div
|
||||
class="ml-4"
|
||||
v-else-if="item?.meta?.source_file_id || item?.meta?.source_url"
|
||||
>
|
||||
<a
|
||||
:href="getFileUrl(item?.meta?.source_file_id) || item?.meta?.source_url"
|
||||
target="_blank"
|
||||
|
|
@ -42,6 +45,11 @@
|
|||
<span :title="item?.document_name?.trim()">{{ item?.document_name }}</span>
|
||||
</a>
|
||||
</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>
|
||||
</el-card>
|
||||
|
|
@ -121,6 +129,7 @@ import ParagraphSourceContent from './ParagraphSourceContent.vue'
|
|||
import { arraySort } from '@/utils/array'
|
||||
import { getImgUrl, getFileUrl } from '@/utils/common'
|
||||
import { t } from '@/locales'
|
||||
import { MsgInfo } from '@/utils/message'
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
|
|
@ -157,6 +166,10 @@ const dialogTitle = ref('')
|
|||
const currentComponent = shallowRef<any>(null)
|
||||
const currentChatDetail = ref<any>(null)
|
||||
const dialogType = ref('')
|
||||
|
||||
function infoMessage() {
|
||||
MsgInfo(t('chat.noDocument'))
|
||||
}
|
||||
function openParagraph(row: any, id?: string) {
|
||||
dialogTitle.value = t('chat.KnowledgeSource.title')
|
||||
const obj = cloneDeep(row)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export default {
|
|||
userInput: 'User Input',
|
||||
quote: 'Quote',
|
||||
download: 'Click to Download',
|
||||
noDocument: 'Original Document Not Found',
|
||||
passwordValidator: {
|
||||
title: 'Enter Password to Access',
|
||||
errorMessage1: 'Password cannot be empty',
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ export default {
|
|||
quote: '引用',
|
||||
download: '点击下载文件',
|
||||
transcribing: '转文字中',
|
||||
noDocument: '原文档不存在',
|
||||
passwordValidator: {
|
||||
title: '请输入密码打开链接',
|
||||
errorMessage1: '密码不能为空',
|
||||
|
|
@ -94,7 +95,7 @@ export default {
|
|||
referenceParagraph: '引用分段',
|
||||
consume: '消耗tokens',
|
||||
consumeTime: '耗时',
|
||||
noSource: '没有检索到知识来源'
|
||||
noSource: '没有检索到知识来源',
|
||||
},
|
||||
paragraphSource: {
|
||||
title: '知识库引用',
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export default {
|
|||
userInput: '用戶輸入',
|
||||
quote: '引用',
|
||||
download: '點擊下載文件',
|
||||
noDocument: '原文檔不存在',
|
||||
passwordValidator: {
|
||||
title: '請輸入密碼打開連結',
|
||||
errorMessage1: '密碼不能為空',
|
||||
|
|
@ -101,7 +102,7 @@ export default {
|
|||
historyRecord: '歷史記錄',
|
||||
currentChat: '本次對話',
|
||||
AiResponse: 'AI 回答',
|
||||
knowedMessage: '已知資訊'
|
||||
knowedMessage: '已知資訊',
|
||||
},
|
||||
editTitle: '編輯標題',
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue