mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 10:12:51 +00:00
fix: folder bugs
This commit is contained in:
parent
949c6d5ce1
commit
2ead8b3ed2
|
|
@ -2,7 +2,7 @@
|
|||
<div class="chat-knowledge-source">
|
||||
<div
|
||||
class="flex align-center mt-16"
|
||||
v-if="(type === 'log' || type === 'debug-ai-chat') ? true : application.show_source"
|
||||
v-if="type === 'log' || type === 'debug-ai-chat' ? true : application.show_source"
|
||||
>
|
||||
<span class="mr-4 color-secondary">{{ $t('chat.KnowledgeSource.title') }}</span>
|
||||
<el-divider direction="vertical" />
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div
|
||||
class="mt-8"
|
||||
v-if="(type === 'log' || type === 'debug-ai-chat') ? true : application.show_source"
|
||||
v-if="type === 'log' || type === 'debug-ai-chat' ? true : application.show_source"
|
||||
>
|
||||
<el-row :gutter="8" v-if="uniqueParagraphList?.length">
|
||||
<template v-for="(item, index) in uniqueParagraphList" :key="index">
|
||||
|
|
@ -51,7 +51,7 @@
|
|||
</div>
|
||||
|
||||
<div
|
||||
v-if="(type === 'log' || type === 'debug-ai-chat') ? true : application.show_exec"
|
||||
v-if="type === 'log' || type === 'debug-ai-chat' ? true : application.show_exec"
|
||||
class="execution-details border-t color-secondary flex-between mt-12"
|
||||
style="padding-top: 12px; padding-bottom: 8px"
|
||||
>
|
||||
|
|
@ -89,13 +89,13 @@
|
|||
<span class="medium ellipsis" :title="dialogTitle" :id="titleId" :class="titleClass">
|
||||
{{ dialogTitle }}
|
||||
</span>
|
||||
<div class="flex align-center mr-8">
|
||||
<span v-if="dialogType === 'pdfDocument'" class="mr-4">
|
||||
<div class="flex align-center mr-8" v-if="dialogType === 'pdfDocument'">
|
||||
<span class="mr-4">
|
||||
<el-button text>
|
||||
<el-icon> <Download /> </el-icon>
|
||||
</el-button>
|
||||
</span>
|
||||
<span v-if="dialogType === 'pdfDocument'">
|
||||
<span>
|
||||
<el-button text> <app-icon iconName="app-export" size="20" /></el-button>
|
||||
</span>
|
||||
<el-divider direction="vertical" />
|
||||
|
|
@ -103,7 +103,11 @@
|
|||
</div>
|
||||
</template>
|
||||
<div class="mb-8">
|
||||
<component :is="currentComponent" :detail="currentChatDetail" :appType="appType"></component>
|
||||
<component
|
||||
:is="currentComponent"
|
||||
:detail="currentChatDetail"
|
||||
:appType="appType"
|
||||
></component>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
<el-button @click.prevent="dialogVisible = false" :loading="loading">
|
||||
{{ $t('common.cancel') }}
|
||||
</el-button>
|
||||
<el-button type="primary" @click="submitHandle" :loading="loading">
|
||||
<el-button type="primary" @click="submitHandle" :disabled="loading" :loading="loading">
|
||||
{{ isEdit ? $t('common.confirm') : $t('common.add') }}
|
||||
</el-button>
|
||||
</span>
|
||||
|
|
@ -54,6 +54,7 @@ import folderApi from '@/api/folder'
|
|||
import { MsgSuccess, MsgAlert } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import useStore from '@/stores'
|
||||
import disable$ from 'dingtalk-jsapi/api/ui/pullToRefresh/disable'
|
||||
const { tool, knowledge, folder } = useStore()
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
:close-on-press-escape="false"
|
||||
>
|
||||
<folder-tree
|
||||
ref="treeRef"
|
||||
:source="source"
|
||||
:data="folderList"
|
||||
:treeStyle="{
|
||||
|
|
@ -15,7 +16,7 @@
|
|||
borderRadius: '6px',
|
||||
padding: '8px',
|
||||
}"
|
||||
:default-expanded-keys="['default']"
|
||||
:default-expanded-keys="[currentNodeKey]"
|
||||
:canOperation="false"
|
||||
class="move-to-dialog-tree"
|
||||
@handleNodeClick="folderClickHandle"
|
||||
|
|
@ -50,17 +51,21 @@ const props = defineProps({
|
|||
},
|
||||
})
|
||||
|
||||
const treeRef = ref()
|
||||
const loading = ref(false)
|
||||
const dialogVisible = ref(false)
|
||||
const folderList = ref<any[]>([])
|
||||
const detail = ref<any>({})
|
||||
const selectForderId = ref<any>('')
|
||||
const currentNodeKey = ref<string>('')
|
||||
|
||||
watch(dialogVisible, (bool) => {
|
||||
if (!bool) {
|
||||
detail.value = {}
|
||||
selectForderId.value = ''
|
||||
folderList.value = []
|
||||
currentNodeKey.value = ''
|
||||
treeRef.value?.clearCurrentKey()
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -74,6 +79,11 @@ function getFolder() {
|
|||
const params = {}
|
||||
folder.asyncGetFolder(props.source, params, loading).then((res: any) => {
|
||||
folderList.value = res.data
|
||||
if (folderList.value?.length > 0) {
|
||||
currentNodeKey.value = folderList.value[0]?.id
|
||||
} else {
|
||||
currentNodeKey.value = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { computed, ref, watch } from 'vue'
|
||||
import { computed, onUnmounted, ref, watch } from 'vue'
|
||||
import { onBeforeRouteLeave } from 'vue-router'
|
||||
import type { TreeInstance } from 'element-plus'
|
||||
import CreateFolderDialog from '@/components/folder-tree/CreateFolderDialog.vue'
|
||||
|
|
@ -245,6 +245,16 @@ function openEditFolder(row: Tree) {
|
|||
function refreshFolder() {
|
||||
emit('refreshTree')
|
||||
}
|
||||
|
||||
function clearCurrentKey() {
|
||||
treeRef.value?.setCurrentKey(undefined)
|
||||
}
|
||||
defineExpose({
|
||||
clearCurrentKey,
|
||||
})
|
||||
onUnmounted(() => {
|
||||
treeRef.value?.setCurrentKey(undefined)
|
||||
})
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.folder-tree {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
class="p-8"
|
||||
/>
|
||||
</template>
|
||||
<ToolListContainer>
|
||||
<ToolListContainer @refreshFolder="refreshFolder">
|
||||
<template #header>
|
||||
<FolderBreadcrumb :folderList="folderList" @click="folderClickHandle" />
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in New Issue