From e7dda56b9fc98872cc76c6b3671aa854de458e28 Mon Sep 17 00:00:00 2001 From: teukkk Date: Fri, 4 Jul 2025 18:21:11 +0800 Subject: [PATCH] feat: openParagraphDocument --- .../ai-chat/component/answer-content/index.vue | 3 ++- .../ParagraphDocumentContent.vue | 7 +++++++ .../knowledge-source-component/index.vue | 16 ++++++++++++++-- ui/src/components/ai-chat/index.vue | 3 ++- ui/src/views/chat/pc/index.vue | 9 +++++++++ 5 files changed, 34 insertions(+), 4 deletions(-) create mode 100644 ui/src/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue diff --git a/ui/src/components/ai-chat/component/answer-content/index.vue b/ui/src/components/ai-chat/component/answer-content/index.vue index 47e12b3b5..2294dc141 100644 --- a/ui/src/components/ai-chat/component/answer-content/index.vue +++ b/ui/src/components/ai-chat/component/answer-content/index.vue @@ -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" /> @@ -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 diff --git a/ui/src/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue b/ui/src/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue new file mode 100644 index 000000000..7669776a7 --- /dev/null +++ b/ui/src/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue @@ -0,0 +1,7 @@ + + + \ No newline at end of file diff --git a/ui/src/components/ai-chat/component/knowledge-source-component/index.vue b/ui/src/components/ai-chat/component/knowledge-source-component/index.vue index ebbed86f9..d595690ab 100644 --- a/ui/src/components/ai-chat/component/knowledge-source-component/index.vue +++ b/ui/src/components/ai-chat/component/knowledge-source-component/index.vue @@ -17,7 +17,7 @@
-
+

{{ item && item?.document_name }}

@@ -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 ( diff --git a/ui/src/components/ai-chat/index.vue b/ui/src/components/ai-chat/index.vue index fed51ac83..f52f95b91 100644 --- a/ui/src/components/ai-chat/index.vue +++ b/ui/src/components/ai-chat/index.vue @@ -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)" > { return common.isMobile() || mode === 'embed' || mode === 'mobile' diff --git a/ui/src/views/chat/pc/index.vue b/ui/src/views/chat/pc/index.vue index 42d2dee02..c138febc1 100644 --- a/ui/src/views/chat/pc/index.vue +++ b/ui/src/views/chat/pc/index.vue @@ -275,6 +275,7 @@ @scroll="handleScroll" @open-execution-detail="openExecutionDetail" @openParagraph="openKnowledgeSource" + @openParagraphDocument="openParagraphDocument" >
@@ -299,6 +300,7 @@ :detail="executionDetail" :type="applicationDetail?.type" /> +
@@ -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 }