mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 01:33:05 +00:00
feat: add workspaceId prop for enhanced document management and retrieval
--bug=1059992 --user=刘瑞斌 【资源管理】应用-对话日志修改内容报错,无法获取知识库 https://www.tapd.cn/62980211/s/1749196 --bug=1059994 --user=刘瑞斌 【资源管理】知识库文档分段迁移报错,无法获取知识库 https://www.tapd.cn/62980211/s/1749198
This commit is contained in:
parent
f43fa25f6a
commit
1a17c7c5df
|
|
@ -65,7 +65,8 @@ const props = defineProps<{
|
|||
default: () => {}
|
||||
}
|
||||
apiType: 'systemShare' | 'workspace' | 'systemManage'
|
||||
isApplication?: boolean
|
||||
isApplication?: boolean,
|
||||
workspaceId?: string,
|
||||
}>()
|
||||
|
||||
const { user } = useStore()
|
||||
|
|
@ -99,8 +100,17 @@ const defaultProps = {
|
|||
const loadTree = async (node: any, resolve: any) => {
|
||||
if (node.isLeaf) return resolve([])
|
||||
const folder_id = node.level === 0 ? user.getWorkspaceId() : node.data.id
|
||||
const obj =
|
||||
props.apiType === 'systemManage'
|
||||
? {
|
||||
workspace_id: props.workspaceId,
|
||||
folder_id: node.level === 0 ? props.workspaceId : node.data.id,
|
||||
}
|
||||
: {
|
||||
folder_id: folder_id,
|
||||
}
|
||||
await loadSharedApi({ type: 'knowledge', systemType: props.apiType })
|
||||
.getKnowledgeList({ folder_id: folder_id }, optionLoading)
|
||||
.getKnowledgeList(obj, optionLoading)
|
||||
.then((res: any) => {
|
||||
resolve(res.data)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@
|
|||
@changeKnowledge="changeKnowledge"
|
||||
@changeDocument="changeDocument"
|
||||
:isApplication="true"
|
||||
:workspace-id="detail.workspace_id"
|
||||
/>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
|
|
@ -67,7 +68,7 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, reactive, computed } from 'vue'
|
||||
import {ref, watch, reactive, computed, onMounted} from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
|
||||
import type { FormInstance, FormRules } from 'element-plus'
|
||||
|
|
@ -125,6 +126,7 @@ const footers = ['markdownTotal', 0, '=', 1, 'scrollSwitch']
|
|||
const SelectKnowledgeDocumentRef = ref()
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
const loading = ref(false)
|
||||
const detail = ref<any>({})
|
||||
|
||||
const form = ref<any>({
|
||||
chat_id: '',
|
||||
|
|
@ -219,6 +221,18 @@ const submitForm = async (formEl: FormInstance | undefined) => {
|
|||
})
|
||||
}
|
||||
|
||||
function getDetail(isLoading = false) {
|
||||
loadSharedApi({ type: 'application', systemType: apiType.value })
|
||||
.getApplicationDetail(id as string, isLoading ? loading : undefined)
|
||||
.then((res: any) => {
|
||||
detail.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(()=>{
|
||||
getDetail()
|
||||
})
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped></style>
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@
|
|||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
>
|
||||
<SelectKnowledgeDocument ref="SelectKnowledgeDocumentRef" :apiType="apiType" />
|
||||
<SelectKnowledgeDocument ref="SelectKnowledgeDocumentRef" :apiType="apiType" :workspace-id="detail.workspace_id"/>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click.prevent="documentDialogVisible = false">
|
||||
|
|
|
|||
|
|
@ -122,12 +122,13 @@
|
|||
ref="SelectDocumentDialogRef"
|
||||
@refresh="refreshMigrateParagraph"
|
||||
:apiType="apiType"
|
||||
:workspace-id="knowledgeDetail.workspace_id"
|
||||
/>
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import {ref, computed, watch, onMounted} from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
|
||||
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
|
||||
|
|
@ -172,6 +173,7 @@ const emit = defineEmits([
|
|||
])
|
||||
const loading = ref(false)
|
||||
const changeStateloading = ref(false)
|
||||
const knowledgeDetail = ref<any>({})
|
||||
const show = ref(false)
|
||||
// card上面存在dropdown菜单
|
||||
const subHovered = ref(false)
|
||||
|
|
@ -198,6 +200,14 @@ async function changeState(row: any) {
|
|||
return false
|
||||
})
|
||||
}
|
||||
function getDetail() {
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.getKnowledgeDetail(id, loading)
|
||||
.then((res: any) => {
|
||||
knowledgeDetail.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
||||
function openGenerateDialog(row: any) {
|
||||
|
|
@ -271,6 +281,11 @@ const dialogVisible = computed(
|
|||
SelectDocumentDialogRef.value?.dialogVisible ||
|
||||
GenerateRelatedDialogRef.value?.dialogVisible,
|
||||
)
|
||||
|
||||
onMounted(() => {
|
||||
getDetail()
|
||||
})
|
||||
|
||||
watch(dialogVisible, (val: boolean) => {
|
||||
emit('dialogVisibleChange', val)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
@changeKnowledge="changeKnowledge"
|
||||
@changeDocument="changeDocument"
|
||||
:isApplication="true"
|
||||
:workspace-id="knowledgeDetail.workspace_id"
|
||||
/>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
|
|
@ -25,7 +26,7 @@
|
|||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch, reactive, computed } from 'vue'
|
||||
import {ref, watch, reactive, computed, onMounted} from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
|
@ -40,7 +41,7 @@ const {
|
|||
|
||||
const emit = defineEmits(['refresh'])
|
||||
const SelectKnowledgeDocumentRef = ref()
|
||||
|
||||
const knowledgeDetail = ref<any>({})
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
const loading = ref(false)
|
||||
|
||||
|
|
@ -78,6 +79,19 @@ const submitForm = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
function getDetail() {
|
||||
loadSharedApi({ type: 'knowledge', systemType: props.apiType })
|
||||
.getKnowledgeDetail(id, loading)
|
||||
.then((res: any) => {
|
||||
knowledgeDetail.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
getDetail()
|
||||
})
|
||||
|
||||
|
||||
function changeKnowledge(dataset_id: string) {
|
||||
localStorage.setItem(id + 'chat_dataset_id', dataset_id)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,6 +182,7 @@
|
|||
ref="SelectDocumentDialogRef"
|
||||
@refresh="refreshMigrateParagraph"
|
||||
:apiType="apiType"
|
||||
:workspaceId="knowledgeDetail.workspace_id"
|
||||
/>
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
|
||||
</div>
|
||||
|
|
@ -220,6 +221,7 @@ const ParagraphDialogRef = ref()
|
|||
const loading = ref(false)
|
||||
const changeStateloading = ref(false)
|
||||
const documentDetail = ref<any>({})
|
||||
const knowledgeDetail = ref<any>({})
|
||||
const paragraphDetail = ref<any[]>([])
|
||||
const title = ref('')
|
||||
const search = ref('')
|
||||
|
|
@ -332,6 +334,12 @@ function getDetail() {
|
|||
.then((res: any) => {
|
||||
documentDetail.value = res.data
|
||||
})
|
||||
|
||||
loadSharedApi({ type: 'knowledge', isShared: isShared.value, systemType: apiType.value })
|
||||
.getKnowledgeDetail(id, loading)
|
||||
.then((res: any) => {
|
||||
knowledgeDetail.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
function getParagraphList() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue