Skip to content

Commit 2ead8b3

Browse files
fix: folder bugs
1 parent 949c6d5 commit 2ead8b3

File tree

5 files changed

+36
-11
lines changed

5 files changed

+36
-11
lines changed

ui/src/components/ai-chat/component/knowledge-source-component/index.vue

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div class="chat-knowledge-source">
33
<div
44
class="flex align-center mt-16"
5-
v-if="(type === 'log' || type === 'debug-ai-chat') ? true : application.show_source"
5+
v-if="type === 'log' || type === 'debug-ai-chat' ? true : application.show_source"
66
>
77
<span class="mr-4 color-secondary">{{ $t('chat.KnowledgeSource.title') }}</span>
88
<el-divider direction="vertical" />
@@ -15,7 +15,7 @@
1515

1616
<div
1717
class="mt-8"
18-
v-if="(type === 'log' || type === 'debug-ai-chat') ? true : application.show_source"
18+
v-if="type === 'log' || type === 'debug-ai-chat' ? true : application.show_source"
1919
>
2020
<el-row :gutter="8" v-if="uniqueParagraphList?.length">
2121
<template v-for="(item, index) in uniqueParagraphList" :key="index">
@@ -51,7 +51,7 @@
5151
</div>
5252

5353
<div
54-
v-if="(type === 'log' || type === 'debug-ai-chat') ? true : application.show_exec"
54+
v-if="type === 'log' || type === 'debug-ai-chat' ? true : application.show_exec"
5555
class="execution-details border-t color-secondary flex-between mt-12"
5656
style="padding-top: 12px; padding-bottom: 8px"
5757
>
@@ -89,21 +89,25 @@
8989
<span class="medium ellipsis" :title="dialogTitle" :id="titleId" :class="titleClass">
9090
{{ dialogTitle }}
9191
</span>
92-
<div class="flex align-center mr-8">
93-
<span v-if="dialogType === 'pdfDocument'" class="mr-4">
92+
<div class="flex align-center mr-8" v-if="dialogType === 'pdfDocument'">
93+
<span class="mr-4">
9494
<el-button text>
9595
<el-icon> <Download /> </el-icon>
9696
</el-button>
9797
</span>
98-
<span v-if="dialogType === 'pdfDocument'">
98+
<span>
9999
<el-button text> <app-icon iconName="app-export" size="20" /></el-button>
100100
</span>
101101
<el-divider direction="vertical" />
102102
</div>
103103
</div>
104104
</template>
105105
<div class="mb-8">
106-
<component :is="currentComponent" :detail="currentChatDetail" :appType="appType"></component>
106+
<component
107+
:is="currentComponent"
108+
:detail="currentChatDetail"
109+
:appType="appType"
110+
></component>
107111
</div>
108112
</el-dialog>
109113
</div>

ui/src/components/folder-tree/CreateFolderDialog.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<el-button @click.prevent="dialogVisible = false" :loading="loading">
4242
{{ $t('common.cancel') }}
4343
</el-button>
44-
<el-button type="primary" @click="submitHandle" :loading="loading">
44+
<el-button type="primary" @click="submitHandle" :disabled="loading" :loading="loading">
4545
{{ isEdit ? $t('common.confirm') : $t('common.add') }}
4646
</el-button>
4747
</span>
@@ -54,6 +54,7 @@ import folderApi from '@/api/folder'
5454
import { MsgSuccess, MsgAlert } from '@/utils/message'
5555
import { t } from '@/locales'
5656
import useStore from '@/stores'
57+
import disable$ from 'dingtalk-jsapi/api/ui/pullToRefresh/disable'
5758
const { tool, knowledge, folder } = useStore()
5859
const emit = defineEmits(['refresh'])
5960

ui/src/components/folder-tree/MoveToDialog.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
:close-on-press-escape="false"
88
>
99
<folder-tree
10+
ref="treeRef"
1011
:source="source"
1112
:data="folderList"
1213
:treeStyle="{
@@ -15,7 +16,7 @@
1516
borderRadius: '6px',
1617
padding: '8px',
1718
}"
18-
:default-expanded-keys="['default']"
19+
:default-expanded-keys="[currentNodeKey]"
1920
:canOperation="false"
2021
class="move-to-dialog-tree"
2122
@handleNodeClick="folderClickHandle"
@@ -50,17 +51,21 @@ const props = defineProps({
5051
},
5152
})
5253
54+
const treeRef = ref()
5355
const loading = ref(false)
5456
const dialogVisible = ref(false)
5557
const folderList = ref<any[]>([])
5658
const detail = ref<any>({})
5759
const selectForderId = ref<any>('')
60+
const currentNodeKey = ref<string>('')
5861
5962
watch(dialogVisible, (bool) => {
6063
if (!bool) {
6164
detail.value = {}
6265
selectForderId.value = ''
6366
folderList.value = []
67+
currentNodeKey.value = ''
68+
treeRef.value?.clearCurrentKey()
6469
}
6570
})
6671
@@ -74,6 +79,11 @@ function getFolder() {
7479
const params = {}
7580
folder.asyncGetFolder(props.source, params, loading).then((res: any) => {
7681
folderList.value = res.data
82+
if (folderList.value?.length > 0) {
83+
currentNodeKey.value = folderList.value[0]?.id
84+
} else {
85+
currentNodeKey.value = ''
86+
}
7787
})
7888
}
7989

ui/src/components/folder-tree/index.vue

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
</template>
9797

9898
<script lang="ts" setup>
99-
import { computed, ref, watch } from 'vue'
99+
import { computed, onUnmounted, ref, watch } from 'vue'
100100
import { onBeforeRouteLeave } from 'vue-router'
101101
import type { TreeInstance } from 'element-plus'
102102
import CreateFolderDialog from '@/components/folder-tree/CreateFolderDialog.vue'
@@ -245,6 +245,16 @@ function openEditFolder(row: Tree) {
245245
function refreshFolder() {
246246
emit('refreshTree')
247247
}
248+
249+
function clearCurrentKey() {
250+
treeRef.value?.setCurrentKey(undefined)
251+
}
252+
defineExpose({
253+
clearCurrentKey,
254+
})
255+
onUnmounted(() => {
256+
treeRef.value?.setCurrentKey(undefined)
257+
})
248258
</script>
249259
<style lang="scss" scoped>
250260
.folder-tree {

ui/src/views/tool/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class="p-8"
1414
/>
1515
</template>
16-
<ToolListContainer>
16+
<ToolListContainer @refreshFolder="refreshFolder">
1717
<template #header>
1818
<FolderBreadcrumb :folderList="folderList" @click="folderClickHandle" />
1919
</template>

0 commit comments

Comments
 (0)