diff --git a/apps/application/sql/list_knowledge_paragraph_by_paragraph_id.sql b/apps/application/sql/list_knowledge_paragraph_by_paragraph_id.sql index 70e034771..fa503452d 100644 --- a/apps/application/sql/list_knowledge_paragraph_by_paragraph_id.sql +++ b/apps/application/sql/list_knowledge_paragraph_by_paragraph_id.sql @@ -3,7 +3,7 @@ SELECT knowledge."name" AS "knowledge_name", knowledge."type" AS "knowledge_type", "document"."name" AS "document_name", - "document"."meta" AS "meta", + "document"."meta"::json AS "meta", "document"."hit_handling_method" AS "hit_handling_method", "document"."directly_return_similarity" as "directly_return_similarity" FROM diff --git a/apps/knowledge/serializers/document.py b/apps/knowledge/serializers/document.py index 10c558b45..a4222e832 100644 --- a/apps/knowledge/serializers/document.py +++ b/apps/knowledge/serializers/document.py @@ -817,6 +817,7 @@ class DocumentSerializers(serializers.Serializer): @staticmethod def get_document_paragraph_model(knowledge_id, instance: Dict): + source_meta = {'source_file_id': instance.get('source_file_id')} if instance.get('source_file_id') else {} document_model = Document( **{ 'knowledge_id': knowledge_id, @@ -826,7 +827,8 @@ class DocumentSerializers(serializers.Serializer): lambda x, y: x + y, [len(p.get('content')) for p in instance.get('paragraphs', [])], 0), - 'meta': instance.get('meta') if instance.get('meta') is not None else {}, + 'meta': {**instance.get('meta'), **source_meta} if instance.get( + 'meta') is not None else source_meta, 'type': instance.get('type') if instance.get('type') is not None else KnowledgeType.BASE }) 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 2294dc141..1df601e64 100644 --- a/ui/src/components/ai-chat/component/answer-content/index.vue +++ b/ui/src/components/ai-chat/component/answer-content/index.vue @@ -9,7 +9,7 @@ class="content" @mouseup="openControl" :style="{ - 'padding-right': showUserAvatar ? 'var(--padding-left)' : '0' + 'padding-right': showUserAvatar ? 'var(--padding-left)' : '0', }" > @@ -46,7 +46,7 @@ :executionIsRightPanel="props.executionIsRightPanel" @open-execution-detail="emit('openExecutionDetail')" @openParagraph="emit('openParagraph')" - @openParagraphDocument="(val: string)=>emit('openParagraphDocument', val)" + @openParagraphDocument="(val: string) => emit('openParagraphDocument', val)" v-if="showSource(chatRecord) && index === chatRecord.answer_text_list.length - 1" /> @@ -56,7 +56,7 @@ class="content" :style="{ 'padding-left': showAvatar ? 'var(--padding-left)' : '0', - 'padding-right': showUserAvatar ? 'var(--padding-left)' : '0' + 'padding-right': showUserAvatar ? 'var(--padding-left)' : '0', }" > { return user.isEnterprise() ? props.application.show_avatar : true @@ -130,8 +135,8 @@ const answer_text_list = computed(() => { chat_record_id: undefined, child_node: undefined, runtime_node_id: undefined, - reasoning_content: undefined - } + reasoning_content: undefined, + }, ] } else if (item instanceof Array) { return item 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 index 7669776a7..8d6026300 100644 --- a/ui/src/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue +++ b/ui/src/components/ai-chat/component/knowledge-source-component/ParagraphDocumentContent.vue @@ -1,7 +1,18 @@ - \ 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 31faa4cec..a1760ebde 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,12 @@
-
+

{{ item && item?.document_name }}

@@ -101,7 +106,7 @@ const props = defineProps({ }, }) -const emit = defineEmits(['openExecutionDetail', 'openParagraph','openParagraphDocument']) +const emit = defineEmits(['openExecutionDetail', 'openParagraph', 'openParagraphDocument']) const dialogVisible = ref(false) const dialogTitle = ref('') @@ -134,9 +139,10 @@ function openExecutionDetail(row: any) { } function openParagraphDocument(row: any) { if (props.executionIsRightPanel) { - emit('openParagraphDocument',row) + emit('openParagraphDocument', row) return } + currentComponent.value = ParagraphDocumentContent dialogTitle.value = row.document_name currentChatDetail.value = row diff --git a/ui/src/views/chat/pc/index.vue b/ui/src/views/chat/pc/index.vue index f13f6b7e8..3cfe32b46 100644 --- a/ui/src/views/chat/pc/index.vue +++ b/ui/src/views/chat/pc/index.vue @@ -33,7 +33,7 @@

{{ applicationDetail?.name }}

- +
@@ -609,6 +609,7 @@ function openParagraphDocument(detail: any, row: any) { rightPanelTitle.value = row.document_name rightPanelType.value = 'paragraphDocument' rightPanelSize.value = 400 + rightPanelDetail.value = row } function closeExecutionDetail() { @@ -716,11 +717,11 @@ function closeExecutionDetail() { .add-button { border: 1px solid var(--el-color-primary); - background-color: #3370FF1A; - color: #3370FF; + background-color: #3370ff1a; + color: #3370ff; font-weight: 500; &:hover { - background-color: #3370FF33; + background-color: #3370ff33; } } @@ -799,12 +800,13 @@ function closeExecutionDetail() { } .chat-pc-popper { - background: linear-gradient(187.61deg, rgba(235, 241, 255, 0.5) 39.6%, rgba(231, 249, 255, 0.5) 94.3%), - #eef1f4 !important; + background: + linear-gradient(187.61deg, rgba(235, 241, 255, 0.5) 39.6%, rgba(231, 249, 255, 0.5) 94.3%), + #eef1f4 !important; .el-menu { background: transparent; } - .el-menu-item-group__title { + .el-menu-item-group__title { padding-bottom: 16px; font-weight: 500; color: var(--app-text-color-secondary); @@ -820,7 +822,7 @@ function closeExecutionDetail() { } &.is-active { background-color: #ffffff; - + color: var(--el-text-color-primary); & > div { font-weight: 500;