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: () => {}
|
default: () => {}
|
||||||
}
|
}
|
||||||
apiType: 'systemShare' | 'workspace' | 'systemManage'
|
apiType: 'systemShare' | 'workspace' | 'systemManage'
|
||||||
isApplication?: boolean
|
isApplication?: boolean,
|
||||||
|
workspaceId?: string,
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
@ -99,8 +100,17 @@ const defaultProps = {
|
|||||||
const loadTree = async (node: any, resolve: any) => {
|
const loadTree = async (node: any, resolve: any) => {
|
||||||
if (node.isLeaf) return resolve([])
|
if (node.isLeaf) return resolve([])
|
||||||
const folder_id = node.level === 0 ? user.getWorkspaceId() : node.data.id
|
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 })
|
await loadSharedApi({ type: 'knowledge', systemType: props.apiType })
|
||||||
.getKnowledgeList({ folder_id: folder_id }, optionLoading)
|
.getKnowledgeList(obj, optionLoading)
|
||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
resolve(res.data)
|
resolve(res.data)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
@changeKnowledge="changeKnowledge"
|
@changeKnowledge="changeKnowledge"
|
||||||
@changeDocument="changeDocument"
|
@changeDocument="changeDocument"
|
||||||
:isApplication="true"
|
:isApplication="true"
|
||||||
|
:workspace-id="detail.workspace_id"
|
||||||
/>
|
/>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
@ -67,7 +68,7 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<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 { useRoute } from 'vue-router'
|
||||||
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
|
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
@ -125,6 +126,7 @@ const footers = ['markdownTotal', 0, '=', 1, 'scrollSwitch']
|
|||||||
const SelectKnowledgeDocumentRef = ref()
|
const SelectKnowledgeDocumentRef = ref()
|
||||||
const dialogVisible = ref<boolean>(false)
|
const dialogVisible = ref<boolean>(false)
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
const detail = ref<any>({})
|
||||||
|
|
||||||
const form = ref<any>({
|
const form = ref<any>({
|
||||||
chat_id: '',
|
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 })
|
defineExpose({ open })
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|||||||
@ -209,7 +209,7 @@
|
|||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
>
|
>
|
||||||
<SelectKnowledgeDocument ref="SelectKnowledgeDocumentRef" :apiType="apiType" />
|
<SelectKnowledgeDocument ref="SelectKnowledgeDocumentRef" :apiType="apiType" :workspace-id="detail.workspace_id"/>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
<el-button @click.prevent="documentDialogVisible = false">
|
<el-button @click.prevent="documentDialogVisible = false">
|
||||||
|
|||||||
@ -122,12 +122,13 @@
|
|||||||
ref="SelectDocumentDialogRef"
|
ref="SelectDocumentDialogRef"
|
||||||
@refresh="refreshMigrateParagraph"
|
@refresh="refreshMigrateParagraph"
|
||||||
:apiType="apiType"
|
:apiType="apiType"
|
||||||
|
:workspace-id="knowledgeDetail.workspace_id"
|
||||||
/>
|
/>
|
||||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
|
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
|
||||||
</el-card>
|
</el-card>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, watch } from 'vue'
|
import {ref, computed, watch, onMounted} from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
|
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
|
||||||
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
|
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
|
||||||
@ -172,6 +173,7 @@ const emit = defineEmits([
|
|||||||
])
|
])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const changeStateloading = ref(false)
|
const changeStateloading = ref(false)
|
||||||
|
const knowledgeDetail = ref<any>({})
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
// card上面存在dropdown菜单
|
// card上面存在dropdown菜单
|
||||||
const subHovered = ref(false)
|
const subHovered = ref(false)
|
||||||
@ -198,6 +200,14 @@ async function changeState(row: any) {
|
|||||||
return false
|
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>>()
|
const GenerateRelatedDialogRef = ref<InstanceType<typeof GenerateRelatedDialog>>()
|
||||||
function openGenerateDialog(row: any) {
|
function openGenerateDialog(row: any) {
|
||||||
@ -271,6 +281,11 @@ const dialogVisible = computed(
|
|||||||
SelectDocumentDialogRef.value?.dialogVisible ||
|
SelectDocumentDialogRef.value?.dialogVisible ||
|
||||||
GenerateRelatedDialogRef.value?.dialogVisible,
|
GenerateRelatedDialogRef.value?.dialogVisible,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
getDetail()
|
||||||
|
})
|
||||||
|
|
||||||
watch(dialogVisible, (val: boolean) => {
|
watch(dialogVisible, (val: boolean) => {
|
||||||
emit('dialogVisibleChange', val)
|
emit('dialogVisibleChange', val)
|
||||||
})
|
})
|
||||||
|
|||||||
@ -13,6 +13,7 @@
|
|||||||
@changeKnowledge="changeKnowledge"
|
@changeKnowledge="changeKnowledge"
|
||||||
@changeDocument="changeDocument"
|
@changeDocument="changeDocument"
|
||||||
:isApplication="true"
|
:isApplication="true"
|
||||||
|
:workspace-id="knowledgeDetail.workspace_id"
|
||||||
/>
|
/>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
@ -25,7 +26,7 @@
|
|||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<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 { useRoute } from 'vue-router'
|
||||||
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
|
import SelectKnowledgeDocument from '@/components/select-knowledge-document/index.vue'
|
||||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||||
@ -40,7 +41,7 @@ const {
|
|||||||
|
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
const SelectKnowledgeDocumentRef = ref()
|
const SelectKnowledgeDocumentRef = ref()
|
||||||
|
const knowledgeDetail = ref<any>({})
|
||||||
const dialogVisible = ref<boolean>(false)
|
const dialogVisible = ref<boolean>(false)
|
||||||
const loading = ref(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) {
|
function changeKnowledge(dataset_id: string) {
|
||||||
localStorage.setItem(id + 'chat_dataset_id', dataset_id)
|
localStorage.setItem(id + 'chat_dataset_id', dataset_id)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,6 +182,7 @@
|
|||||||
ref="SelectDocumentDialogRef"
|
ref="SelectDocumentDialogRef"
|
||||||
@refresh="refreshMigrateParagraph"
|
@refresh="refreshMigrateParagraph"
|
||||||
:apiType="apiType"
|
:apiType="apiType"
|
||||||
|
:workspaceId="knowledgeDetail.workspace_id"
|
||||||
/>
|
/>
|
||||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
|
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
|
||||||
</div>
|
</div>
|
||||||
@ -220,6 +221,7 @@ const ParagraphDialogRef = ref()
|
|||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const changeStateloading = ref(false)
|
const changeStateloading = ref(false)
|
||||||
const documentDetail = ref<any>({})
|
const documentDetail = ref<any>({})
|
||||||
|
const knowledgeDetail = ref<any>({})
|
||||||
const paragraphDetail = ref<any[]>([])
|
const paragraphDetail = ref<any[]>([])
|
||||||
const title = ref('')
|
const title = ref('')
|
||||||
const search = ref('')
|
const search = ref('')
|
||||||
@ -332,6 +334,12 @@ function getDetail() {
|
|||||||
.then((res: any) => {
|
.then((res: any) => {
|
||||||
documentDetail.value = res.data
|
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() {
|
function getParagraphList() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user