feat: openParagraphDocument

This commit is contained in:
teukkk 2025-07-04 18:21:11 +08:00
parent a097d23299
commit e7dda56b9f
5 changed files with 34 additions and 4 deletions

View File

@ -46,6 +46,7 @@
:executionIsRightPanel="props.executionIsRightPanel"
@open-execution-detail="emit('openExecutionDetail')"
@openParagraph="emit('openParagraph')"
@openParagraphDocument="(val: string)=>emit('openParagraphDocument', val)"
v-if="showSource(chatRecord) && index === chatRecord.answer_text_list.length - 1"
/>
</el-card>
@ -91,7 +92,7 @@ const props = defineProps<{
const { user } = useStore()
const emit = defineEmits(['update:chatRecord', 'openExecutionDetail', 'openParagraph'])
const emit = defineEmits(['update:chatRecord', 'openExecutionDetail', 'openParagraph','openParagraphDocument'])
const showAvatar = computed(() => {
return user.isEnterprise() ? props.application.show_avatar : true

View File

@ -0,0 +1,7 @@
<template>
<div>
TODO 内容
</div>
</template>
<script setup lang="ts"></script>

View File

@ -17,7 +17,7 @@
<div class="flex-between">
<div class="flex align-center">
<img :src="getImgUrl(item && item?.document_name)" alt="" width="24" />
<div class="ml-4 ellipsis-1" :title="item?.document_name" v-if="!item.source_url">
<div class="ml-4 ellipsis-1" :title="item?.document_name" v-if="!item.source_url" @click="openParagraphDocument(item)">
<p>{{ item && item?.document_name }}</p>
</div>
<div class="ml-8" v-else>
@ -81,6 +81,7 @@
import { computed, ref, shallowRef } from 'vue'
import { cloneDeep } from 'lodash'
import ExecutionDetailContent from './ExecutionDetailContent.vue'
import ParagraphDocumentContent from './ParagraphDocumentContent.vue'
import ParagraphSourceContent from './ParagraphSourceContent.vue'
import { arraySort } from '@/utils/array'
import { getImgUrl, getNormalizedUrl } from '@/utils/common'
@ -100,7 +101,7 @@ const props = defineProps({
},
})
const emit = defineEmits(['openExecutionDetail', 'openParagraph'])
const emit = defineEmits(['openExecutionDetail', 'openParagraph','openParagraphDocument'])
const dialogVisible = ref(false)
const dialogTitle = ref('')
@ -131,6 +132,17 @@ function openExecutionDetail(row: any) {
currentChatDetail.value = row
dialogVisible.value = true
}
function openParagraphDocument(row: any) {
if (props.executionIsRightPanel) {
emit('openParagraphDocument',row)
return
}
currentComponent.value = ParagraphDocumentContent
dialogTitle.value = row.document_name
currentChatDetail.value = row
dialogVisible.value = true
}
const uniqueParagraphList = computed(() => {
const seen = new Set()
return (

View File

@ -51,6 +51,7 @@
:executionIsRightPanel="props.executionIsRightPanel"
@open-execution-detail="emit('openExecutionDetail', chatList[index])"
@openParagraph="emit('openParagraph', chatList[index])"
@openParagraphDocument="(val: any)=>emit('openParagraphDocument', chatList[index], val)"
></AnswerContent>
</template>
<TransitionContent
@ -138,7 +139,7 @@ const props = withDefaults(
type: 'ai-chat',
},
)
const emit = defineEmits(['refresh', 'scroll', 'openExecutionDetail', 'openParagraph'])
const emit = defineEmits(['refresh', 'scroll', 'openExecutionDetail', 'openParagraph','openParagraphDocument'])
const { application, common } = useStore()
const isMobile = computed(() => {
return common.isMobile() || mode === 'embed' || mode === 'mobile'

View File

@ -275,6 +275,7 @@
@scroll="handleScroll"
@open-execution-detail="openExecutionDetail"
@openParagraph="openKnowledgeSource"
@openParagraphDocument="openParagraphDocument"
>
</AiChat>
</div>
@ -299,6 +300,7 @@
:detail="executionDetail"
:type="applicationDetail?.type"
/>
<ParagraphDocumentContent v-else />
</div>
</el-splitter-panel>
</el-splitter>
@ -330,6 +332,7 @@ import { t } from '@/locales'
import type { ResetCurrentUserPasswordRequest } from '@/api/type/user'
import ExecutionDetailContent from '@/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue'
import ParagraphSourceContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue'
import ParagraphDocumentContent from '@/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue'
import { cloneDeep } from 'lodash'
useResize()
@ -601,6 +604,12 @@ async function openKnowledgeSource(row: any) {
rightPanelSize.value = 400
}
function openParagraphDocument(detail: any, row: any) {
rightPanelTitle.value = row.document_name
rightPanelType.value = 'paragraphDocument'
rightPanelSize.value = 400
}
function closeExecutionDetail() {
rightPanelSize.value = 0
}