mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:02:46 +00:00
feat: openParagraphDocument
This commit is contained in:
parent
a097d23299
commit
e7dda56b9f
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<template>
|
||||
<div>
|
||||
TODO 内容
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts"></script>
|
||||
|
|
@ -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 (
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue