mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-26 09:43:10 +00:00
This commit is contained in:
parent
bba7a60789
commit
1c96897d01
|
|
@ -57,7 +57,7 @@ const emit = defineEmits(['update:modelValue', 'submitDialog'])
|
|||
|
||||
const route = useRoute()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -88,7 +88,7 @@ function getRangeFromLineAndColumn(state: any, line: number, column: number, end
|
|||
|
||||
const regexpLinter = linter(async (view) => {
|
||||
const diagnostics: Diagnostic[] = []
|
||||
await loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
await loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.postPylint(view.state.doc.toString())
|
||||
.then((ok: any) => {
|
||||
ok.data.forEach((element: any) => {
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="['document', 'knowledge'].includes(apiType)"
|
||||
v-if="['document', 'knowledge'].includes(apiSubmitType)"
|
||||
:label="$t('components.selectParagraph.title')"
|
||||
prop="state"
|
||||
>
|
||||
|
|
@ -72,8 +72,6 @@
|
|||
<script setup lang="ts">
|
||||
import { reactive, ref, watch, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import documentApi from '@/api/knowledge/document'
|
||||
import paragraphApi from '@/api/knowledge/paragraph'
|
||||
import useStore from '@/stores'
|
||||
import { groupBy } from 'lodash'
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
|
|
@ -81,19 +79,15 @@ import { t } from '@/locales'
|
|||
import type { FormInstance } from 'element-plus'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const props = defineProps<{
|
||||
apiType: 'systemShare' | 'workspace' | 'systemManage'
|
||||
}>()
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, documentId }, // id为knowledgeID
|
||||
} = route as any
|
||||
const type = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const { model, prompt, user } = useStore()
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
|
|
@ -103,7 +97,7 @@ const loading = ref<boolean>(false)
|
|||
const dialogVisible = ref<boolean>(false)
|
||||
const modelOptions = ref<any>(null)
|
||||
const idList = ref<string[]>([])
|
||||
const apiType = ref('') // 文档document或段落paragraph
|
||||
const apiSubmitType = ref('') // 文档document或段落paragraph
|
||||
const state = ref<'all' | 'error'>('error')
|
||||
const stateMap = {
|
||||
all: ['0', '1', '2', '3', '4', '5', 'n'],
|
||||
|
|
@ -141,7 +135,7 @@ const open = (ids: string[], type: string, _knowledgeId?: string) => {
|
|||
knowledgeId.value = _knowledgeId
|
||||
getModel()
|
||||
idList.value = ids
|
||||
apiType.value = type
|
||||
apiSubmitType.value = type
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
|
|
@ -153,33 +147,37 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||
if (valid) {
|
||||
// 保存提示词
|
||||
prompt.save(user.userInfo?.id as string, form.value)
|
||||
if (apiType.value === 'paragraph') {
|
||||
if (apiSubmitType.value === 'paragraph') {
|
||||
const data = {
|
||||
...form.value,
|
||||
paragraph_id_list: idList.value,
|
||||
}
|
||||
paragraphApi.putBatchGenerateRelated(id, documentId, data, loading).then(() => {
|
||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||
emit('refresh')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else if (apiType.value === 'document') {
|
||||
loadSharedApi({ type: 'paragraph', systemType: props.apiType })
|
||||
.putBatchGenerateRelated(id, documentId, data, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||
emit('refresh')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else if (apiSubmitType.value === 'document') {
|
||||
const data = {
|
||||
...form.value,
|
||||
document_id_list: idList.value,
|
||||
state_list: stateMap[state.value],
|
||||
}
|
||||
documentApi.putBatchGenerateRelated(id, data, loading).then(() => {
|
||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||
emit('refresh')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else if (apiType.value === 'knowledge') {
|
||||
loadSharedApi({ type: 'knowledge', systemType: props.apiType })
|
||||
.putBatchGenerateRelated(id, data, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||
emit('refresh')
|
||||
dialogVisible.value = false
|
||||
})
|
||||
} else if (apiSubmitType.value === 'knowledge') {
|
||||
const data = {
|
||||
...form.value,
|
||||
state_list: stateMap[state.value],
|
||||
}
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: props.apiType })
|
||||
.putGenerateRelated(id ? id : knowledgeId.value, data, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('views.document.generateQuestion.successMessage'))
|
||||
|
|
@ -192,7 +190,7 @@ const submitHandle = async (formEl: FormInstance) => {
|
|||
|
||||
function getModel() {
|
||||
loading.value = true
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: props.apiType })
|
||||
.getKnowledgeModel()
|
||||
.then((res: any) => {
|
||||
modelOptions.value = groupBy(res?.data, 'provider')
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<div class="breadcrumb ml-4 mt-4 mb-12 flex">
|
||||
<back-button :to="activeMenu" class="mt-4"></back-button>
|
||||
<back-button to="-1" class="mt-4"></back-button>
|
||||
<div class="flex align-center">
|
||||
<el-avatar
|
||||
v-if="isApplication && isAppIcon(current?.icon)"
|
||||
|
|
@ -21,94 +21,6 @@
|
|||
|
||||
<div class="ellipsis" :title="current?.name">{{ current?.name }}</div>
|
||||
</div>
|
||||
<!-- <el-dropdown
|
||||
placement="bottom"
|
||||
trigger="click"
|
||||
@command="changeMenu"
|
||||
class="w-full"
|
||||
style="display: block"
|
||||
>
|
||||
<div class="breadcrumb-hover flex-between cursor">
|
||||
<div class="flex align-center">
|
||||
<el-avatar
|
||||
v-if="isApplication && isAppIcon(current?.icon)"
|
||||
shape="square"
|
||||
:size="24"
|
||||
style="background: none"
|
||||
class="mr-8"
|
||||
>
|
||||
<img :src="current?.icon" alt="" />
|
||||
</el-avatar>
|
||||
<LogoIcon
|
||||
v-else-if="isApplication"
|
||||
height="28px"
|
||||
style="width: 28px; height: 28px; display: block"
|
||||
/>
|
||||
<KnowledgeIcon v-else-if="isKnowledge" :type="current?.type" />
|
||||
|
||||
<div class="ellipsis" :title="current?.name">{{ current?.name }}</div>
|
||||
</div>
|
||||
|
||||
<el-button text>
|
||||
<el-icon><CaretBottom /></el-icon>
|
||||
</el-button>
|
||||
</div>
|
||||
<template #dropdown>
|
||||
<el-scrollbar>
|
||||
<div style="max-height: 400px">
|
||||
<el-dropdown-menu>
|
||||
<template v-for="(item, index) in list" :key="index">
|
||||
<div :class="item.id === id ? 'dropdown-active' : ''">
|
||||
<el-dropdown-item :command="item.id">
|
||||
<div class="flex align-center">
|
||||
<el-avatar
|
||||
v-if="isApplication && isAppIcon(item?.icon)"
|
||||
shape="square"
|
||||
:size="24"
|
||||
style="background: none"
|
||||
class="mr-8"
|
||||
>
|
||||
<img :src="item?.icon" alt="" />
|
||||
</el-avatar>
|
||||
|
||||
<el-avatar
|
||||
v-else-if="isApplication"
|
||||
:name="item.name"
|
||||
pinyinColor
|
||||
class="mr-12"
|
||||
shape="square"
|
||||
:size="24"
|
||||
/>
|
||||
|
||||
<KnowledgeIcon v-if="isKnowledge" :type="item.type" />
|
||||
|
||||
<span class="ellipsis" :title="item?.name"> {{ item?.name }}</span>
|
||||
</div>
|
||||
</el-dropdown-item>
|
||||
</div>
|
||||
</template>
|
||||
</el-dropdown-menu>
|
||||
</div>
|
||||
</el-scrollbar>
|
||||
<div class="breadcrumb__footer border-t" style="padding: 8px 11px; min-width: 200px">
|
||||
<template v-if="isApplication">
|
||||
<div class="w-full text-left cursor" @click="openCreateDialog">
|
||||
<el-button link>
|
||||
<el-icon class="mr-4"><Plus /></el-icon>
|
||||
{{ $t('views.application.createApplication') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
<template v-else-if="isKnowledge">
|
||||
<div class="w-full text-left cursor" @click="openCreateDialog">
|
||||
<el-button link>
|
||||
<el-icon class="mr-4"><Plus /></el-icon> {{ $t('views.knowledge.createKnowledge') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</el-dropdown> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -127,7 +39,7 @@ const {
|
|||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -154,7 +66,7 @@ const isKnowledge = computed(() => {
|
|||
|
||||
function getKnowledgeDetail() {
|
||||
loading.value = true
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.getKnowledgeDetail(id)
|
||||
.then((res: any) => {
|
||||
current.value = res.data
|
||||
|
|
|
|||
|
|
@ -23,9 +23,12 @@ import AppMain from '@/layout/app-main/index.vue'
|
|||
import useStore from '@/stores'
|
||||
import { useRoute } from 'vue-router'
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { folderId }, // id为knowledgeID
|
||||
} = route as any
|
||||
|
||||
const isShared = computed(() => {
|
||||
return route.path.endsWith('hared') || route.name.includes('ResourceManagement')
|
||||
return folderId === 'shared' || route.name.includes('ResourceManagement')
|
||||
})
|
||||
const { theme } = useStore()
|
||||
const isDefaultTheme = computed(() => {
|
||||
|
|
|
|||
|
|
@ -150,9 +150,9 @@ const systemRouter = {
|
|||
[RoleConst.ADMIN],
|
||||
[PermissionConst.SHARED_TOOL_READ],
|
||||
[EditionConst.IS_EE],
|
||||
'OR'
|
||||
)
|
||||
]
|
||||
'OR',
|
||||
),
|
||||
],
|
||||
},
|
||||
component: () => import('@/views/system-shared/ToolSharedIndex.vue'),
|
||||
},
|
||||
|
|
@ -169,9 +169,9 @@ const systemRouter = {
|
|||
[RoleConst.ADMIN],
|
||||
[PermissionConst.SHARED_MODEL_READ],
|
||||
[EditionConst.IS_EE],
|
||||
'OR'
|
||||
)
|
||||
]
|
||||
'OR',
|
||||
),
|
||||
],
|
||||
},
|
||||
component: () => import('@/views/system-shared/ModelSharedIndex.vue'),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,16 +1,22 @@
|
|||
import knowledgeWorkspaceApi from '@/api/knowledge/knowledge'
|
||||
import documentWorkspaceApi from '@/api/knowledge/document'
|
||||
import paragraphWorkspaceApi from '@/api/knowledge/paragraph'
|
||||
import modelWorkspaceApi from '@/api/model/model'
|
||||
import toolWorkspaceApi from '@/api/tool/tool'
|
||||
import sharedWorkspaceApi from '@/api/shared-workspace'
|
||||
import toolSystemShareApi from '@/api/system-shared/tool'
|
||||
import modelSystemShareApi from '@/api/system-shared/model'
|
||||
import knowledgeSystemShareApi from '@/api/system-shared/knowledge'
|
||||
import documentSystemShareApi from '@/api/system-shared/document'
|
||||
import paragraphSystemShareApi from '@/api/system-shared/paragraph'
|
||||
|
||||
// 普通 API
|
||||
const workspaceApiMap = {
|
||||
knowledge: knowledgeWorkspaceApi,
|
||||
model: modelWorkspaceApi,
|
||||
tool: toolWorkspaceApi,
|
||||
document: documentWorkspaceApi,
|
||||
paragraph: paragraphWorkspaceApi,
|
||||
} as any
|
||||
|
||||
// 系统分享 API
|
||||
|
|
@ -18,6 +24,8 @@ const systemShareApiMap = {
|
|||
knowledge: knowledgeSystemShareApi,
|
||||
model: modelSystemShareApi,
|
||||
tool: toolSystemShareApi,
|
||||
document: documentSystemShareApi,
|
||||
paragraph: paragraphSystemShareApi,
|
||||
} as any
|
||||
|
||||
// 资源管理 API
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ import { getImgUrl } from '@/utils/utils'
|
|||
import { t } from '@/locales'
|
||||
import type Node from 'element-plus/es/components/tree/src/model/node'
|
||||
import documentApi from '@/api/knowledge/document'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ import { useRouter, useRoute } from 'vue-router'
|
|||
import SetRules from './upload/SetRules.vue'
|
||||
import ResultSuccess from './upload/ResultSuccess.vue'
|
||||
import UploadComponent from './upload/UploadComponent.vue'
|
||||
import documentApi from '@/api/knowledge/document'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
import { MsgConfirm, MsgSuccess } from '@/utils/message'
|
||||
import { t } from '@/locales'
|
||||
import useStore from '@/stores'
|
||||
|
|
@ -75,6 +75,16 @@ const {
|
|||
query: { id }, // id为knowledgeID,有id的是上传文档
|
||||
} = route
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const SetRulesRef = ref()
|
||||
const UploadComponentRef = ref()
|
||||
|
||||
|
|
@ -94,11 +104,15 @@ async function next() {
|
|||
})
|
||||
if (id) {
|
||||
// QA文档上传
|
||||
documentApi.postQADocument(id as string, fd, loading).then((res) => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({ path: `/knowledge/${id}/${folderId}/document` })
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.postQADocument(id as string, fd, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({
|
||||
path: `/knowledge/${id}/${folderId}/document`,
|
||||
})
|
||||
})
|
||||
}
|
||||
} else if (documentsType.value === 'table') {
|
||||
const fd = new FormData()
|
||||
|
|
@ -109,11 +123,15 @@ async function next() {
|
|||
})
|
||||
if (id) {
|
||||
// table文档上传
|
||||
documentApi.postTableDocument(id as string, fd, loading).then((res) => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({ path: `/knowledge/${id}/${folderId}/document` })
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.postTableDocument(id as string, fd, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({
|
||||
path: `/knowledge/${id}/${folderId}/document`,
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
if (active.value++ > 2) active.value = 0
|
||||
|
|
@ -152,7 +170,9 @@ function submit() {
|
|||
.then(() => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
clearStore()
|
||||
router.push({ path: `/knowledge/${id}/${folderId}/document` })
|
||||
router.push({
|
||||
path: `/knowledge/${id}/${folderId}/document`,
|
||||
})
|
||||
})
|
||||
.catch(() => {
|
||||
loading.value = false
|
||||
|
|
|
|||
|
|
@ -66,7 +66,8 @@ const route = useRoute()
|
|||
const {
|
||||
params: { id }, // id为knowledgeID
|
||||
} = route as any
|
||||
const type = computed(() => {
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -99,7 +100,7 @@ const loadTree = (node: any, resolve: any) => {
|
|||
console.log(node)
|
||||
if (node.isLeaf) return resolve([])
|
||||
const folder_id = node.level === 0 ? '' : node.data.id
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.getKnowledgeList(folder_id, loading)
|
||||
.then((res: any) => {
|
||||
resolve(res.data)
|
||||
|
|
|
|||
|
|
@ -7,26 +7,32 @@
|
|||
<div class="flex-between">
|
||||
<div>
|
||||
<el-button
|
||||
v-if="knowledgeDetail.type === 0 && permissionPrecise.doc_create(id)"
|
||||
type="danger"
|
||||
v-if="knowledgeDetail?.type === 0 && permissionPrecise.doc_create(id)"
|
||||
type="primary"
|
||||
@click="
|
||||
router.push({ path: `/knowledge/document/upload/${folderId}`, query: { id: id } })
|
||||
router.push({
|
||||
path: `/knowledge/document/upload/${folderId}`,
|
||||
query: { id: id },
|
||||
})
|
||||
"
|
||||
>{{ $t('views.document.uploadDocument') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="knowledgeDetail.type === 1 && permissionPrecise.doc_create(id)"
|
||||
v-if="knowledgeDetail?.type === 1 && permissionPrecise.doc_create(id)"
|
||||
type="primary"
|
||||
@click="importDoc"
|
||||
>{{ $t('views.document.importDocument') }}
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="knowledgeDetail.type === 2 && permissionPrecise.doc_create(id)"
|
||||
v-if="knowledgeDetail?.type === 2 && permissionPrecise.doc_create(id)"
|
||||
type="primary"
|
||||
@click="
|
||||
router.push({
|
||||
path: `/knowledge/import`,
|
||||
query: { id: id, folder_token: knowledgeDetail.meta.folder_token },
|
||||
query: {
|
||||
id: id,
|
||||
folder_token: knowledgeDetail?.meta.folder_token,
|
||||
},
|
||||
})
|
||||
"
|
||||
>{{ $t('views.document.importDocument') }}
|
||||
|
|
@ -73,7 +79,7 @@
|
|||
divided
|
||||
@click="syncLarkMulDocument"
|
||||
:disabled="multipleSelection.length === 0"
|
||||
v-if="knowledgeDetail.type === 2 && permissionPrecise.doc_sync(id)"
|
||||
v-if="knowledgeDetail?.type === 2 && permissionPrecise.doc_sync(id)"
|
||||
>{{ $t('views.document.syncDocument') }}
|
||||
</el-dropdown-item>
|
||||
|
||||
|
|
@ -103,7 +109,7 @@
|
|||
class="mt-16"
|
||||
:data="documentData"
|
||||
:pagination-config="paginationConfig"
|
||||
:quick-create="knowledgeDetail.type === 0 && permissionPrecise.doc_create(id)"
|
||||
:quick-create="knowledgeDetail?.type === 0 && permissionPrecise.doc_create(id)"
|
||||
@sizeChange="handleSizeChange"
|
||||
@changePage="getList"
|
||||
@cell-mouse-enter="cellMouseEnter"
|
||||
|
|
@ -351,7 +357,7 @@
|
|||
/>
|
||||
</span>
|
||||
<el-divider direction="vertical" />
|
||||
<template v-if="knowledgeDetail.type === 0">
|
||||
<template v-if="knowledgeDetail?.type === 0">
|
||||
<span
|
||||
class="mr-4"
|
||||
v-if="
|
||||
|
|
@ -451,7 +457,7 @@
|
|||
</el-dropdown>
|
||||
</span>
|
||||
</template>
|
||||
<template v-if="knowledgeDetail.type === 1 || knowledgeDetail.type === 2">
|
||||
<template v-if="knowledgeDetail?.type === 1 || knowledgeDetail?.type === 2">
|
||||
<span class="mr-4">
|
||||
<el-button
|
||||
type="primary"
|
||||
|
|
@ -571,14 +577,13 @@
|
|||
<SyncWebDialog ref="SyncWebDialogRef" @refresh="refresh" />
|
||||
<!-- 选择知识库 -->
|
||||
<SelectKnowledgeDialog ref="selectKnowledgeDialogRef" @refresh="refreshMigrate" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="getList" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="getList" :apiType="apiType" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted, onBeforeUnmount, computed } from 'vue'
|
||||
import { useRouter, useRoute, onBeforeRouteLeave, onBeforeRouteUpdate } from 'vue-router'
|
||||
import { ElTable } from 'element-plus'
|
||||
import documentApi from '@/api/knowledge/document'
|
||||
import ImportDocumentDialog from './component/ImportDocumentDialog.vue'
|
||||
import SyncWebDialog from '@/views/knowledge/component/SyncWebDialog.vue'
|
||||
import SelectKnowledgeDialog from './component/SelectKnowledgeDialog.vue'
|
||||
|
|
@ -598,32 +603,12 @@ import permissionMap from '@/permission'
|
|||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const route = useRoute()
|
||||
const { folder, user } = useStore()
|
||||
|
||||
const type = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['knowledge'][type.value]
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
const {
|
||||
params: { id, folderId }, // id为knowledgeID
|
||||
} = route as any
|
||||
|
||||
const { common, knowledge, document } = useStore()
|
||||
const { common, document } = useStore()
|
||||
const storeKey = 'documents'
|
||||
const getTaskState = (status: string, taskType: number) => {
|
||||
const statusList = status.split('').reverse()
|
||||
return taskType - 1 > statusList.length + 1 ? 'n' : statusList[taskType - 1]
|
||||
}
|
||||
onBeforeRouteUpdate(() => {
|
||||
common.savePage(storeKey, null)
|
||||
common.saveCondition(storeKey, null)
|
||||
|
|
@ -639,6 +624,25 @@ onBeforeRouteLeave((to: any) => {
|
|||
})
|
||||
}
|
||||
})
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['knowledge'][apiType.value]
|
||||
})
|
||||
|
||||
const getTaskState = (status: string, taskType: number) => {
|
||||
const statusList = status.split('').reverse()
|
||||
return taskType - 1 > statusList.length + 1 ? 'n' : statusList[taskType - 1]
|
||||
}
|
||||
|
||||
const beforePagination = computed(() => common.paginationConfig[storeKey])
|
||||
const beforeSearch = computed(() => common.search[storeKey])
|
||||
const embeddingContentDialogRef = ref<InstanceType<typeof EmbeddingContentDialog>>()
|
||||
|
|
@ -666,14 +670,14 @@ const title = ref('')
|
|||
const selectKnowledgeDialogRef = ref()
|
||||
|
||||
const exportDocument = (document: any) => {
|
||||
documentApi
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.exportDocument(document.name, document.knowledge_id, document.id, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.exportSuccess'))
|
||||
})
|
||||
}
|
||||
const exportDocumentZip = (document: any) => {
|
||||
documentApi
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.exportDocumentZip(document.name, document.knowledge_id, document.id, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.exportSuccess'))
|
||||
|
|
@ -691,10 +695,12 @@ function cancelTaskHandle(val: any) {
|
|||
id_list: arr,
|
||||
type: val,
|
||||
}
|
||||
documentApi.putBatchCancelTask(id, obj, loading).then(() => {
|
||||
MsgSuccess(t('views.document.tip.cancelSuccess'))
|
||||
multipleTableRef.value?.clearSelection()
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.putBatchCancelTask(id, obj, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('views.document.tip.cancelSuccess'))
|
||||
multipleTableRef.value?.clearSelection()
|
||||
})
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
|
|
@ -734,9 +740,11 @@ function beforeCommand(attr: string, val: any, task_type?: number) {
|
|||
}
|
||||
|
||||
const cancelTask = (row: any, task_type: number) => {
|
||||
documentApi.putCancelTask(id, row.id, { type: task_type }).then(() => {
|
||||
MsgSuccess(t('views.document.tip.sendMessage'))
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.putCancelTask(id, row.id, { type: task_type })
|
||||
.then(() => {
|
||||
MsgSuccess(t('views.document.tip.sendMessage'))
|
||||
})
|
||||
}
|
||||
|
||||
function importDoc() {
|
||||
|
|
@ -791,9 +799,11 @@ function syncLarkDocument(row: any) {
|
|||
confirmButtonClass: 'color-danger',
|
||||
})
|
||||
.then(() => {
|
||||
documentApi.putLarkDocumentSync(id, row.id).then(() => {
|
||||
getList()
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.putLarkDocumentSync(id, row.id)
|
||||
.then(() => {
|
||||
getList()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
|
@ -805,9 +815,11 @@ function syncWebDocument(row: any) {
|
|||
confirmButtonClass: 'color-danger',
|
||||
})
|
||||
.then(() => {
|
||||
documentApi.putDocumentSync(row.knowledge_id, row.id).then(() => {
|
||||
getList()
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.putDocumentSync(row.knowledge_id, row.id)
|
||||
.then(() => {
|
||||
getList()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
} else {
|
||||
|
|
@ -822,9 +834,11 @@ function syncWebDocument(row: any) {
|
|||
|
||||
function refreshDocument(row: any) {
|
||||
const embeddingDocument = (stateList: Array<string>) => {
|
||||
return documentApi.putDocumentRefresh(row.knowledge_id, row.id, stateList).then(() => {
|
||||
getList()
|
||||
})
|
||||
return loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.putDocumentRefresh(row.knowledge_id, row.id, stateList)
|
||||
.then(() => {
|
||||
getList()
|
||||
})
|
||||
}
|
||||
embeddingContentDialogRef.value?.open(embeddingDocument)
|
||||
}
|
||||
|
|
@ -834,7 +848,7 @@ function rowClickHandle(row: any, column: any) {
|
|||
return
|
||||
}
|
||||
|
||||
router.push({ path: `/paragraph/${id}/${row.id}` })
|
||||
router.push({ path: `/paragraph/${id}/${row.id}`, query: { type: apiType.value } })
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -861,10 +875,12 @@ function syncMulDocument() {
|
|||
arr.push(v.id)
|
||||
}
|
||||
})
|
||||
documentApi.putMulSyncDocument(id, arr, loading).then(() => {
|
||||
MsgSuccess(t('views.document.sync.successMessage'))
|
||||
getList()
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.putMulSyncDocument(id, arr, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('views.document.sync.successMessage'))
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function syncLarkMulDocument() {
|
||||
|
|
@ -874,10 +890,12 @@ function syncLarkMulDocument() {
|
|||
arr.push(v.id)
|
||||
}
|
||||
})
|
||||
documentApi.delMulLarkSyncDocument(id, arr, loading).then(() => {
|
||||
MsgSuccess(t('views.document.sync.successMessage'))
|
||||
getList()
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.delMulLarkSyncDocument(id, arr, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('views.document.sync.successMessage'))
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function deleteMulDocument() {
|
||||
|
|
@ -896,11 +914,13 @@ function deleteMulDocument() {
|
|||
arr.push(v.id)
|
||||
}
|
||||
})
|
||||
documentApi.delMulDocument(id, arr, loading).then(() => {
|
||||
MsgSuccess(t('views.document.delete.successMessage'))
|
||||
multipleTableRef.value?.clearSelection()
|
||||
getList()
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.delMulDocument(id, arr, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('views.document.delete.successMessage'))
|
||||
multipleTableRef.value?.clearSelection()
|
||||
getList()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
|
@ -908,10 +928,12 @@ function deleteMulDocument() {
|
|||
function batchRefresh() {
|
||||
const arr: string[] = multipleSelection.value.map((v) => v.id)
|
||||
const embeddingBatchDocument = (stateList: Array<string>) => {
|
||||
documentApi.putBatchRefresh(id, arr, stateList, loading).then(() => {
|
||||
MsgSuccess(t('views.document.tip.vectorizationSuccess'))
|
||||
multipleTableRef.value?.clearSelection()
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.putBatchRefresh(id, arr, stateList, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('views.document.tip.vectorizationSuccess'))
|
||||
multipleTableRef.value?.clearSelection()
|
||||
})
|
||||
}
|
||||
embeddingContentDialogRef.value?.open(embeddingBatchDocument)
|
||||
}
|
||||
|
|
@ -926,10 +948,12 @@ function deleteDocument(row: any) {
|
|||
},
|
||||
)
|
||||
.then(() => {
|
||||
documentApi.delDocument(id, row.id, loading).then(() => {
|
||||
MsgSuccess(t('common.deleteSuccess'))
|
||||
getList()
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.delDocument(id, row.id, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.deleteSuccess'))
|
||||
getList()
|
||||
})
|
||||
})
|
||||
.catch(() => {})
|
||||
}
|
||||
|
|
@ -938,9 +962,9 @@ function deleteDocument(row: any) {
|
|||
更新名称或状态
|
||||
*/
|
||||
function updateData(documentId: string, data: any, msg: string) {
|
||||
documentApi
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.putDocument(id, documentId, data, loading)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
const index = documentData.value.findIndex((v) => v.id === documentId)
|
||||
documentData.value.splice(index, 1, res.data)
|
||||
MsgSuccess(msg)
|
||||
|
|
@ -995,16 +1019,16 @@ function getList(bool?: boolean) {
|
|||
order_by: orderBy.value,
|
||||
folder_id: folderId,
|
||||
}
|
||||
documentApi
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.getDocumentPage(id as string, paginationConfig.value, param, bool ? undefined : loading)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
documentData.value = res.data.records
|
||||
paginationConfig.value.total = res.data.total
|
||||
})
|
||||
}
|
||||
|
||||
function getDetail() {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.getKnowledgeDetail(id, loading)
|
||||
.then((res: any) => {
|
||||
knowledgeDetail.value = res.data
|
||||
|
|
|
|||
|
|
@ -16,12 +16,24 @@
|
|||
</div>
|
||||
</template>
|
||||
<template #extra>
|
||||
<el-button @click="router.push({ path: `/knowledge` })">{{
|
||||
$t('views.knowledge.ResultSuccess.buttons.toknowledge')
|
||||
}}</el-button>
|
||||
<el-button
|
||||
@click="
|
||||
router.push({
|
||||
path: `/knowledge`,
|
||||
query: {
|
||||
type: apiType,
|
||||
},
|
||||
})
|
||||
"
|
||||
>{{ $t('views.knowledge.ResultSuccess.buttons.toknowledge') }}</el-button
|
||||
>
|
||||
<el-button
|
||||
type="primary"
|
||||
@click="router.push({ path: `/knowledge/${data?.id}/${folderId}/document` })"
|
||||
@click="
|
||||
router.push({
|
||||
path: `/knowledge/${data?.id}/${folderId}/document`,
|
||||
})
|
||||
"
|
||||
>{{ $t('views.knowledge.ResultSuccess.buttons.toDocument') }}</el-button
|
||||
>
|
||||
</template>
|
||||
|
|
@ -68,18 +80,29 @@ import { computed } from 'vue'
|
|||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { numberFormat } from '@/utils/utils'
|
||||
import { filesize, getImgUrl } from '@/utils/utils'
|
||||
const route = useRoute()
|
||||
|
||||
const props = defineProps({
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {},
|
||||
},
|
||||
})
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, folderId }, // id为knowledgeID
|
||||
} = route as any
|
||||
const router = useRouter()
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const paragraph_count = computed(() =>
|
||||
props.data?.document_list.reduce((sum: number, obj: any) => (sum += obj.paragraph_count), 0),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -123,9 +123,9 @@ import { ref, computed, onMounted, reactive, watch } from 'vue'
|
|||
import ParagraphPreview from '@/views/knowledge/component/ParagraphPreview.vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { cutFilename } from '@/utils/utils'
|
||||
import documentApi from '@/api/knowledge/document'
|
||||
import useStore from '@/stores'
|
||||
import type { KeyValue } from '@/api/type/common'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const { knowledge } = useStore()
|
||||
const documentsFiles = computed(() => knowledge.documentsFiles)
|
||||
const splitPatternList = ref<Array<KeyValue<string, string>>>([])
|
||||
|
|
@ -133,6 +133,17 @@ const route = useRoute()
|
|||
const {
|
||||
query: { id }, // id为knowledgeID
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
|
||||
const radio = ref('1')
|
||||
const loading = ref(false)
|
||||
const paragraphList = ref<any[]>([])
|
||||
|
|
@ -187,7 +198,7 @@ function splitDocument() {
|
|||
}
|
||||
})
|
||||
}
|
||||
documentApi
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.postSplitDocument(id, fd)
|
||||
.then((res: any) => {
|
||||
const list = res.data
|
||||
|
|
@ -218,9 +229,11 @@ function splitDocument() {
|
|||
}
|
||||
|
||||
const initSplitPatternList = () => {
|
||||
documentApi.listSplitPattern(id, patternLoading).then((ok) => {
|
||||
splitPatternList.value = ok.data
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.listSplitPattern(id, patternLoading)
|
||||
.then((ok) => {
|
||||
splitPatternList.value = ok.data
|
||||
})
|
||||
}
|
||||
|
||||
watch(radio, () => {
|
||||
|
|
|
|||
|
|
@ -196,24 +196,37 @@
|
|||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, onUnmounted, onMounted, computed, watch, nextTick } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import type { UploadFiles } from 'element-plus'
|
||||
import { filesize, getImgUrl, isRightType } from '@/utils/utils'
|
||||
import { MsgError } from '@/utils/message'
|
||||
import documentApi from '@/api/knowledge/document'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
import useStore from '@/stores'
|
||||
import { t } from '@/locales'
|
||||
|
||||
const route = useRoute()
|
||||
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
return 'systemManage'
|
||||
} else {
|
||||
return 'workspace'
|
||||
}
|
||||
})
|
||||
const { knowledge } = useStore()
|
||||
const documentsFiles = computed(() => knowledge.documentsFiles)
|
||||
const documentsType = computed(() => knowledge.documentsType)
|
||||
const form = ref({
|
||||
fileType: 'txt',
|
||||
fileList: [] as any
|
||||
fileList: [] as any,
|
||||
})
|
||||
|
||||
const rules = reactive({
|
||||
fileList: [
|
||||
{ required: true, message: t('views.document.upload.requiredMessage'), trigger: 'change' }
|
||||
]
|
||||
{ required: true, message: t('views.document.upload.requiredMessage'), trigger: 'change' },
|
||||
],
|
||||
})
|
||||
const FormRef = ref()
|
||||
|
||||
|
|
@ -223,16 +236,16 @@ watch(form.value, (value) => {
|
|||
})
|
||||
|
||||
function downloadTemplate(type: string) {
|
||||
documentApi.exportQATemplate(
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value }).exportQATemplate(
|
||||
`${type}${t('views.document.upload.template')}.${type == 'csv' ? type : 'xlsx'}`,
|
||||
type
|
||||
type,
|
||||
)
|
||||
}
|
||||
|
||||
function downloadTableTemplate(type: string) {
|
||||
documentApi.exportTableTemplate(
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value }).exportTableTemplate(
|
||||
`${type}${t('views.document.upload.template')}.${type == 'csv' ? type : 'xlsx'}`,
|
||||
type
|
||||
type,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -303,13 +316,13 @@ onMounted(() => {
|
|||
onUnmounted(() => {
|
||||
form.value = {
|
||||
fileType: 'txt',
|
||||
fileList: []
|
||||
fileList: [],
|
||||
}
|
||||
})
|
||||
|
||||
defineExpose({
|
||||
validate,
|
||||
form
|
||||
form,
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
|
|
@ -323,5 +336,4 @@ defineExpose({
|
|||
color: var(--el-color-primary-light-5);
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ const {
|
|||
meta: { activeMenu },
|
||||
params: { id },
|
||||
} = route as any
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -324,7 +324,7 @@ function getHitTestList() {
|
|||
...formInline.value,
|
||||
}
|
||||
if (isDataset.value) {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.putKnowledgeHitTest(id, obj, loading)
|
||||
.then((res: any) => {
|
||||
paragraphDetail.value = res.data && arraySort(res.data, 'comprehensive_score', true)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
shadow="never"
|
||||
class="mb-8 w-full"
|
||||
style="line-height: 22px"
|
||||
v-if="detail.type === 0"
|
||||
v-if="detail?.type === 0"
|
||||
>
|
||||
<div class="flex align-center">
|
||||
<el-avatar class="mr-8 avatar-blue" shape="square" :size="32">
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
<el-form-item
|
||||
:label="$t('views.knowledge.form.source_url.label')"
|
||||
prop="source_url"
|
||||
v-if="detail.type === 1"
|
||||
v-if="detail?.type === 1"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.source_url"
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$t('views.knowledge.form.selector.label')"
|
||||
v-if="detail.type === 1"
|
||||
v-if="detail?.type === 1"
|
||||
>
|
||||
<el-input
|
||||
v-model="form.selector"
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
@blur="form.selector = form.selector.trim()"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="App ID" prop="app_id" v-if="detail.type === 2">
|
||||
<el-form-item label="App ID" prop="app_id" v-if="detail?.type === 2">
|
||||
<el-input
|
||||
v-model="form.app_id"
|
||||
:placeholder="
|
||||
|
|
@ -104,7 +104,7 @@
|
|||
"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="App Secret" prop="app_id" v-if="detail.type === 2">
|
||||
<el-form-item label="App Secret" prop="app_id" v-if="detail?.type === 2">
|
||||
<el-input
|
||||
v-model="form.app_secret"
|
||||
type="password"
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="Folder Token" prop="folder_token" v-if="detail.type === 2">
|
||||
<el-form-item label="Folder Token" prop="folder_token" v-if="detail?.type === 2">
|
||||
<el-input
|
||||
v-model="form.folder_token"
|
||||
:placeholder="
|
||||
|
|
@ -123,7 +123,7 @@
|
|||
/>
|
||||
</el-form-item>
|
||||
|
||||
<div v-if="detail.type === 0">
|
||||
<div v-if="detail?.type === 0">
|
||||
<h4 class="title-decoration-1 mb-16">
|
||||
{{ $t('common.otherSetting') }}
|
||||
</h4>
|
||||
|
|
@ -173,7 +173,7 @@ const {
|
|||
params: { id },
|
||||
} = route as any
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -248,20 +248,20 @@ async function submit() {
|
|||
})
|
||||
.then(() => {
|
||||
if (detail.value.type === 2) {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.putLarkKnowledge(id, obj, loading)
|
||||
.then(() => {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.putReEmbeddingKnowledge(id)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
})
|
||||
} else {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.putKnowledge(id, obj, loading)
|
||||
.then(() => {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.putReEmbeddingKnowledge(id)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
|
|
@ -272,17 +272,17 @@ async function submit() {
|
|||
.catch(() => {})
|
||||
} else {
|
||||
if (detail.value.type === 2) {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.putLarkKnowledge(id, obj, loading)
|
||||
.then(() => {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.putReEmbeddingKnowledge(id)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
})
|
||||
})
|
||||
} else {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.putKnowledge(id, obj, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
|
|
@ -295,12 +295,12 @@ async function submit() {
|
|||
}
|
||||
|
||||
function getDetail() {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.getKnowledgeDetail(id, loading)
|
||||
.then((res: any) => {
|
||||
detail.value = res.data
|
||||
cloneModelId.value = res.data?.embedding_model_id
|
||||
if (detail.value.type === '1' || detail.value.type === '2') {
|
||||
if (detail.value?.type === 1 || detail.value?.type === 2) {
|
||||
form.value = res.data.meta
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -176,7 +176,9 @@
|
|||
:description="item.desc"
|
||||
class="cursor"
|
||||
@click="
|
||||
router.push({ path: `/knowledge/${item.id}/${folder.currentFolder.id}/document` })
|
||||
router.push({
|
||||
path: `/knowledge/${item.id}/${folder.currentFolder.id || 'shared'}/document`,
|
||||
})
|
||||
"
|
||||
>
|
||||
<template #icon>
|
||||
|
|
@ -188,7 +190,7 @@
|
|||
</el-text>
|
||||
</template>
|
||||
<template #tag>
|
||||
<el-tag v-if="isShared" type="info" class="info-tag">
|
||||
<el-tag v-if="isShared || isSystemShare" type="info" class="info-tag">
|
||||
{{ t('views.system.shared.label') }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
|
@ -250,7 +252,7 @@
|
|||
icon="Setting"
|
||||
@click.stop="
|
||||
router.push({
|
||||
path: `/knowledge/${item.id}/${folder.currentFolder.id}/setting`,
|
||||
path: `/knowledge/${item.id}/${folder.currentFolder.id || 'shared'}/setting`,
|
||||
})
|
||||
"
|
||||
v-if="permissionPrecise.setting(item.id)"
|
||||
|
|
@ -295,7 +297,7 @@
|
|||
|
||||
<component :is="currentCreateDialog" ref="CreateKnowledgeDialogRef" v-if="!isShared" />
|
||||
<CreateFolderDialog ref="CreateFolderDialogRef" v-if="!isShared" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" :apiType="apiType" />
|
||||
<SyncWebDialog ref="SyncWebDialogRef" v-if="!isShared" />
|
||||
<AuthorizedWorkspace
|
||||
ref="AuthorizedWorkspaceDialogRef"
|
||||
|
|
@ -328,7 +330,7 @@ const router = useRouter()
|
|||
const route = useRoute()
|
||||
const { folder, user, knowledge } = useStore()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -338,14 +340,14 @@ const type = computed(() => {
|
|||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['knowledge'][type.value]
|
||||
return permissionMap['knowledge'][apiType.value]
|
||||
})
|
||||
|
||||
const isShared = computed(() => {
|
||||
return folder.currentFolder.id === 'share'
|
||||
})
|
||||
const isSystemShare = computed(() => {
|
||||
return type.value === 'systemShare'
|
||||
return apiType.value === 'systemShare'
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
|
|
@ -365,7 +367,6 @@ const paginationConfig = reactive({
|
|||
})
|
||||
|
||||
const knowledgeList = ref<any[]>([])
|
||||
const currentFolder = ref<any>({})
|
||||
|
||||
const CreateKnowledgeDialogRef = ref()
|
||||
const currentCreateDialog = shallowRef<any>(null)
|
||||
|
|
@ -393,7 +394,7 @@ function openCreateDialog(data: any) {
|
|||
}
|
||||
|
||||
function reEmbeddingKnowledge(row: any) {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.putReEmbeddingKnowledge(row.id)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.submitSuccess'))
|
||||
|
|
@ -418,14 +419,14 @@ function openGenerateDialog(row: any) {
|
|||
}
|
||||
|
||||
const exportKnowledge = (item: any) => {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.exportKnowledge(item.name, item.id, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.exportSuccess'))
|
||||
})
|
||||
}
|
||||
const exportZipKnowledge = (item: any) => {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.exportZipKnowledge(item.name, item.id, loading)
|
||||
.then(() => {
|
||||
MsgSuccess(t('common.exportSuccess'))
|
||||
|
|
@ -442,7 +443,7 @@ function deleteKnowledge(row: any) {
|
|||
},
|
||||
)
|
||||
.then(() => {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.delKnowledge(row.id, loading)
|
||||
.then(() => {
|
||||
const list = cloneDeep(knowledge.knowledgeList)
|
||||
|
|
@ -483,7 +484,7 @@ function getList() {
|
|||
[search_type.value]: search_form.value[search_type.value],
|
||||
}
|
||||
knowledge
|
||||
.asyncGetKnowledgeListPage(paginationConfig, isShared.value, type.value, params, loading)
|
||||
.asyncGetKnowledgeListPage(paginationConfig, isShared.value, apiType.value, params, loading)
|
||||
.then((res: any) => {
|
||||
paginationConfig.total = res.data?.total
|
||||
knowledge.setKnowledgeList([...knowledgeList.value, ...res.data.records])
|
||||
|
|
@ -495,7 +496,10 @@ function clickFolder(item: any) {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (type.value !== 'workspace') {
|
||||
if (apiType.value !== 'workspace') {
|
||||
folder.setCurrentFolder({
|
||||
id: '',
|
||||
})
|
||||
getList()
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
|||
import { t } from '@/locales'
|
||||
|
||||
const route = useRoute()
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -70,7 +70,7 @@ const open = (id: string) => {
|
|||
}
|
||||
|
||||
const submit = () => {
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.putSyncWebKnowledge(knowledgeId.value, method.value, loading)
|
||||
.then((res: any) => {
|
||||
emit('refresh', res.data)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ const emit = defineEmits(['refresh'])
|
|||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -65,11 +65,16 @@ const submitHandle = async () => {
|
|||
folder_id: currentFolder.value?.id,
|
||||
...BaseFormRef.value.form,
|
||||
}
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.postKnowledge(obj, loading)
|
||||
.then((res: any) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
router.push({ path: `/knowledge/${res.data.id}/${currentFolder.value.id}/document` })
|
||||
router.push({
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id}/document`,
|
||||
query: {
|
||||
type: apiType.value,
|
||||
},
|
||||
})
|
||||
emit('refresh')
|
||||
})
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ const emit = defineEmits(['refresh'])
|
|||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -157,11 +157,16 @@ const submitHandle = async () => {
|
|||
...BaseFormRef.value.form,
|
||||
...knowledgeForm.value,
|
||||
}
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.postLarkKnowledge(obj, loading)
|
||||
.then((res: any) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
router.push({ path: `/knowledge/${res.data.id}/${currentFolder.value.id}/document` })
|
||||
router.push({
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id}/document`,
|
||||
query: {
|
||||
type: apiType.value,
|
||||
},
|
||||
})
|
||||
emit('refresh')
|
||||
})
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ const emit = defineEmits(['refresh'])
|
|||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -111,11 +111,16 @@ const submitHandle = async () => {
|
|||
...BaseFormRef.value.form,
|
||||
...knowledgeForm.value,
|
||||
}
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.postWebKnowledge(obj, loading)
|
||||
.then((res: any) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
router.push({ path: `/knowledge/${res.data.id}/${currentFolder.value.id}/document` })
|
||||
router.push({
|
||||
path: `/knowledge/${res.data.id}/${currentFolder.value.id}/document`,
|
||||
query: {
|
||||
type: apiType.value,
|
||||
},
|
||||
})
|
||||
emit('refresh')
|
||||
})
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -30,8 +30,7 @@ import { useRoute } from 'vue-router'
|
|||
import useStore from '@/stores'
|
||||
const route = useRoute()
|
||||
const { folder, knowledge } = useStore()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -41,7 +40,7 @@ const type = computed(() => {
|
|||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['knowledge'][type.value]
|
||||
return permissionMap['knowledge'][apiType.value]
|
||||
})
|
||||
const loading = ref(false)
|
||||
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
|||
|
||||
const route = useRoute()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -390,7 +390,7 @@ const submit = () => {
|
|||
?.validate()
|
||||
.then(() => {
|
||||
if (providerValue.value) {
|
||||
loadSharedApi({ type: 'model', systemType: type.value })
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.createModel(
|
||||
{
|
||||
...base_form_data.value,
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
|||
|
||||
const route = useRoute()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -222,7 +222,7 @@ const list_base_model = (model_type: any, change?: boolean) => {
|
|||
}
|
||||
const open = (provider: Provider, model: Model) => {
|
||||
modelValue.value = model
|
||||
loadSharedApi({ type: 'model', systemType: type.value })
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getModelById(model.id, formLoading)
|
||||
.then((ok: any) => {
|
||||
modelValue.value = ok.data
|
||||
|
|
@ -255,7 +255,7 @@ const close = () => {
|
|||
const submit = () => {
|
||||
dynamicsFormRef.value?.validate().then(() => {
|
||||
if (modelValue.value) {
|
||||
loadSharedApi({ type: 'model', systemType: type.value })
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.updateModel(
|
||||
modelValue.value.id,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ const deleteModel = () => {
|
|||
}
|
||||
|
||||
const cancelDownload = () => {
|
||||
loadSharedApi({ type: 'model', systemType: type.value })
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.pauseDownload(props.model.id)
|
||||
.then(() => {
|
||||
downModel.value = undefined
|
||||
|
|
@ -227,7 +227,7 @@ const icon = computed(() => {
|
|||
const initInterval = () => {
|
||||
interval = setInterval(() => {
|
||||
if (currentModel.value.status === 'DOWNLOAD') {
|
||||
loadSharedApi({ type: 'model', systemType: type.value })
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getModelMetaById(props.model.id)
|
||||
.then((ok: any) => {
|
||||
downModel.value = ok.data
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ const props = defineProps<{
|
|||
|
||||
const route = useRoute()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -112,7 +112,7 @@ const AddParamRef = ref()
|
|||
const open = () => {
|
||||
dialogVisible.value = true
|
||||
loading.value = true
|
||||
loadSharedApi({ type: 'model', systemType: type.value })
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.getModelParamsForm(props.model.id, loading)
|
||||
.then((ok: any) => {
|
||||
loading.value = false
|
||||
|
|
@ -164,7 +164,7 @@ function refresh(data: any, index: any) {
|
|||
}
|
||||
|
||||
function submit() {
|
||||
loadSharedApi({ type: 'model', systemType: type.value })
|
||||
loadSharedApi({ type: 'model', systemType: apiType.value })
|
||||
.updateModelParamsForm(props.model.id, modelParamsForm.value, loading)
|
||||
.then((ok: any) => {
|
||||
MsgSuccess(t('views.model.tip.saveSuccessMessage'))
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ import permissionMap from '@/permission'
|
|||
|
||||
const route = useRoute()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -141,10 +141,10 @@ const type = computed(() => {
|
|||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['model'][type.value]
|
||||
return permissionMap['model'][apiType.value]
|
||||
})
|
||||
const isSystemShare = computed(() => {
|
||||
return type.value === 'systemShare'
|
||||
return apiType.value === 'systemShare'
|
||||
})
|
||||
const commonList1 = ref()
|
||||
const commonList2 = ref()
|
||||
|
|
@ -202,7 +202,7 @@ const openCreateModel = (provider?: Provider, model_type?: string) => {
|
|||
|
||||
const list_model = () => {
|
||||
const params = active_provider.value?.provider ? { provider: active_provider.value.provider } : {}
|
||||
loadSharedApi({ type: 'model', isShared: isShared.value, systemType: type.value })
|
||||
loadSharedApi({ type: 'model', isShared: isShared.value, systemType: apiType.value })
|
||||
.getModel({ ...model_search_form.value, ...params }, list_model_loading)
|
||||
.then((ok: any) => {
|
||||
model_list.value = ok.data
|
||||
|
|
|
|||
|
|
@ -68,11 +68,11 @@
|
|||
|
||||
<ParagraphDialog ref="ParagraphDialogRef" :title="title" @refresh="refresh" />
|
||||
<SelectDocumentDialog ref="SelectDocumentDialogRef" @refresh="refreshMigrateParagraph" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
|
||||
</el-card>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, useSlots } from 'vue'
|
||||
import { ref, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { t } from '@/locales'
|
||||
import useStore from '@/stores'
|
||||
|
|
@ -80,17 +80,21 @@ import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vu
|
|||
import ParagraphDialog from '@/views/paragraph/component/ParagraphDialog.vue'
|
||||
import SelectDocumentDialog from '@/views/paragraph/component/SelectDocumentDialog.vue'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
|
||||
const props = defineProps<{
|
||||
data: any
|
||||
disabled?: boolean
|
||||
}>()
|
||||
const { paragraph } = useStore()
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, documentId },
|
||||
query: { type },
|
||||
} = route as any
|
||||
const props = defineProps<{
|
||||
data: any
|
||||
disabled?: boolean
|
||||
}>()
|
||||
|
||||
const apiType = computed(() => {
|
||||
return type as 'systemShare' | 'workspace' | 'systemManage'
|
||||
})
|
||||
|
||||
const emit = defineEmits(['changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph'])
|
||||
const loading = ref(false)
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ const {
|
|||
params: { id, documentId }, // id为knowledgeID
|
||||
} = route as any
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -147,7 +147,7 @@ const defaultProps = {
|
|||
const loadTree = (node: any, resolve: any) => {
|
||||
if (node.isLeaf) return resolve([])
|
||||
const folder_id = node.level === 0 ? '' : node.data.id
|
||||
loadSharedApi({ type: 'knowledge', systemType: type.value })
|
||||
loadSharedApi({ type: 'knowledge', systemType: apiType.value })
|
||||
.getKnowledgeList(folder_id, optionLoading)
|
||||
.then((res: any) => {
|
||||
resolve(res.data)
|
||||
|
|
|
|||
|
|
@ -138,30 +138,31 @@
|
|||
</el-card>
|
||||
<ParagraphDialog ref="ParagraphDialogRef" :title="title" @refresh="refresh" />
|
||||
<SelectDocumentDialog ref="SelectDocumentDialogRef" @refresh="refreshMigrateParagraph" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, onMounted, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import documentApi from '@/api/knowledge/document'
|
||||
import paragraphApi from '@/api/knowledge/paragraph'
|
||||
import ParagraphDialog from './component/ParagraphDialog.vue'
|
||||
import ParagraphCard from './component/ParagraphCard.vue'
|
||||
import SelectDocumentDialog from './component/SelectDocumentDialog.vue'
|
||||
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
|
||||
import { VueDraggable } from 'vue-draggable-plus'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
import useStore from '@/stores'
|
||||
import { t } from '@/locales'
|
||||
import disable$ from 'dingtalk-jsapi/api/ui/pullToRefresh/disable'
|
||||
const { paragraph } = useStore()
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, documentId },
|
||||
query: { type },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
return type as 'systemShare' | 'workspace' | 'systemManage'
|
||||
})
|
||||
|
||||
const SelectDocumentDialogRef = ref()
|
||||
const ParagraphDialogRef = ref()
|
||||
const loading = ref(false)
|
||||
|
|
@ -224,7 +225,7 @@ function deleteMulParagraph() {
|
|||
},
|
||||
)
|
||||
.then(() => {
|
||||
paragraphApi
|
||||
loadSharedApi({ type: 'paragraph', systemType: apiType.value })
|
||||
.putMulParagraph(id, documentId, multipleSelection.value, changeStateloading)
|
||||
.then(() => {
|
||||
paragraphDetail.value = paragraphDetail.value.filter(
|
||||
|
|
@ -242,14 +243,6 @@ function batchSelectedHandle(bool: boolean) {
|
|||
multipleSelection.value = []
|
||||
}
|
||||
|
||||
function selectHandle(id: string) {
|
||||
if (multipleSelection.value.includes(id)) {
|
||||
multipleSelection.value.splice(multipleSelection.value.indexOf(id), 1)
|
||||
} else {
|
||||
multipleSelection.value.push(id)
|
||||
}
|
||||
}
|
||||
|
||||
function searchHandle() {
|
||||
paginationConfig.current_page = 1
|
||||
paragraphDetail.value = []
|
||||
|
|
@ -262,13 +255,15 @@ function addParagraph() {
|
|||
}
|
||||
|
||||
function getDetail() {
|
||||
documentApi.getDocumentDetail(id, documentId, loading).then((res) => {
|
||||
documentDetail.value = res.data
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.getDocumentDetail(id, documentId, loading)
|
||||
.then((res: any) => {
|
||||
documentDetail.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
function getParagraphList() {
|
||||
paragraphApi
|
||||
loadSharedApi({ type: 'paragraph', systemType: apiType.value })
|
||||
.getParagraphPage(
|
||||
id,
|
||||
documentId,
|
||||
|
|
@ -276,7 +271,7 @@ function getParagraphList() {
|
|||
search.value && { [searchType.value]: search.value },
|
||||
loading,
|
||||
)
|
||||
.then((res) => {
|
||||
.then((res: any) => {
|
||||
paragraphDetail.value = [...paragraphDetail.value, ...res.data.records]
|
||||
paginationConfig.total = res.data.total
|
||||
})
|
||||
|
|
@ -314,7 +309,12 @@ function onEnd(event?: any) {
|
|||
paragraph_id: paragraphDetail.value[event.newIndex].id,
|
||||
new_position: paragraphDetail.value[event.newIndex].position,
|
||||
}
|
||||
paragraphApi.putAdjustPosition(id, documentId, obj, loading)
|
||||
loadSharedApi({ type: 'paragraph', systemType: apiType.value }).putAdjustPosition(
|
||||
id,
|
||||
documentId,
|
||||
obj,
|
||||
loading,
|
||||
)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
|
|
|
|||
|
|
@ -7,17 +7,17 @@
|
|||
<div class="flex-between">
|
||||
<div>
|
||||
<el-button type="primary" @click="createProblem"
|
||||
v-if="permissionPrecise.problem_create(id)"
|
||||
v-if="permissionPrecise.problem_create(id)"
|
||||
>
|
||||
{{ $t('views.problem.createProblem') }}
|
||||
</el-button>
|
||||
<el-button @click="relateProblem()" :disabled="multipleSelection.length === 0"
|
||||
v-if="permissionPrecise.problem_relate(id)"
|
||||
v-if="permissionPrecise.problem_relate(id)"
|
||||
>
|
||||
{{ $t('views.problem.relateParagraph.title') }}
|
||||
</el-button>
|
||||
<el-button @click="deleteMulDocument" :disabled="multipleSelection.length === 0"
|
||||
v-if="permissionPrecise.problem_delete(id)"
|
||||
v-if="permissionPrecise.problem_delete(id)"
|
||||
>
|
||||
{{ $t('views.problem.setting.batchDelete') }}
|
||||
</el-button>
|
||||
|
|
@ -160,9 +160,12 @@ import permissionMap from '@/permission'
|
|||
|
||||
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id }, // 知识库id
|
||||
} = route as any
|
||||
const { folder, user } = useStore()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -172,11 +175,9 @@ const type = computed(() => {
|
|||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['knowledge'][type.value]
|
||||
return permissionMap['knowledge'][apiType.value]
|
||||
})
|
||||
const {
|
||||
params: { id }, // 知识库id
|
||||
} = route as any
|
||||
|
||||
|
||||
const { problem } = useStore()
|
||||
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ import { MsgError } from '@/utils/message'
|
|||
import documentApi from '@/api/resource-management/document'
|
||||
import useStore from '@/stores/modules-resource-management'
|
||||
import { t } from '@/locales'
|
||||
|
||||
const { knowledge } = useStore()
|
||||
const documentsFiles = computed(() => knowledge.documentsFiles)
|
||||
const documentsType = computed(() => knowledge.documentsType)
|
||||
|
|
|
|||
|
|
@ -134,14 +134,13 @@
|
|||
</el-card>
|
||||
<ParagraphDialog ref="ParagraphDialogRef" :title="title" @refresh="refresh" />
|
||||
<SelectDocumentDialog ref="SelectDocumentDialogRef" @refresh="refreshMigrateParagraph" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" />
|
||||
<GenerateRelatedDialog ref="GenerateRelatedDialogRef" @refresh="refresh" :apiType="apiType" />
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, onMounted, computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { cloneDeep } from 'lodash'
|
||||
import documentApi from '@/api/resource-management/document'
|
||||
import paragraphApi from '@/api/resource-management/paragraph'
|
||||
import ParagraphDialog from './component/ParagraphDialog.vue'
|
||||
import ParagraphCard from './component/ParagraphCard.vue'
|
||||
|
|
@ -149,14 +148,18 @@ import SelectDocumentDialog from './component/SelectDocumentDialog.vue'
|
|||
import GenerateRelatedDialog from '@/components/generate-related-dialog/index.vue'
|
||||
import { VueDraggable } from 'vue-draggable-plus'
|
||||
import { MsgSuccess, MsgConfirm } from '@/utils/message'
|
||||
import useStore from '@/stores/modules-resource-management'
|
||||
import { t } from '@/locales'
|
||||
const { paragraph } = useStore()
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
const route = useRoute()
|
||||
const {
|
||||
params: { id, documentId },
|
||||
query: { type },
|
||||
} = route as any
|
||||
|
||||
const apiType = computed(() => {
|
||||
return type as 'systemShare' | 'workspace' | 'systemManage'
|
||||
})
|
||||
|
||||
const SelectDocumentDialogRef = ref()
|
||||
const ParagraphDialogRef = ref()
|
||||
const loading = ref(false)
|
||||
|
|
@ -254,9 +257,11 @@ function addParagraph() {
|
|||
}
|
||||
|
||||
function getDetail() {
|
||||
documentApi.getDocumentDetail(id, documentId, loading).then((res) => {
|
||||
documentDetail.value = res.data
|
||||
})
|
||||
loadSharedApi({ type: 'document', systemType: apiType.value })
|
||||
.getDocumentDetail(id, documentId, loading)
|
||||
.then((res) => {
|
||||
documentDetail.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
function getParagraphList() {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
|||
|
||||
const route = useRoute()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -160,7 +160,7 @@ watch(debugVisible, (bool) => {
|
|||
const submit = async (formEl: FormInstance | undefined) => {
|
||||
const validate = formEl ? formEl.validate() : Promise.resolve()
|
||||
Promise.all([dynamicsFormRef.value?.validate(), validate]).then(() => {
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.postToolDebug(form.value, loading)
|
||||
.then((res: any) => {
|
||||
if (res.code === 500) {
|
||||
|
|
|
|||
|
|
@ -264,10 +264,13 @@ import useStore from '@/stores'
|
|||
import permissionMap from '@/permission'
|
||||
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
|
||||
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
})
|
||||
const route = useRoute()
|
||||
const { folder, user } = useStore()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -277,12 +280,10 @@ const type = computed(() => {
|
|||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['tool'][type.value]
|
||||
return permissionMap['tool'][apiType.value]
|
||||
})
|
||||
|
||||
const props = defineProps({
|
||||
title: String,
|
||||
})
|
||||
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
const FieldFormDialogRef = ref()
|
||||
|
|
@ -424,7 +425,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
await formEl.validate((valid: any) => {
|
||||
if (valid) {
|
||||
if (isEdit.value) {
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.putTool(form.value?.id as string, form.value, loading)
|
||||
.then((res: any) => {
|
||||
MsgSuccess(t('common.editSuccess'))
|
||||
|
|
@ -436,7 +437,7 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||
folder_id: folder.currentFolder?.id,
|
||||
...form.value,
|
||||
}
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.postTool(obj, loading)
|
||||
.then((res: any) => {
|
||||
MsgSuccess(t('common.createSuccess'))
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ const emit = defineEmits(['refresh'])
|
|||
|
||||
const route = useRoute()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -68,7 +68,7 @@ watch(debugVisible, (bool) => {
|
|||
|
||||
const submit = async () => {
|
||||
dynamicsFormRef.value.validate().then(() => {
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.putTool(form.value?.id as string, form.value, loading)
|
||||
.then((res: any) => {
|
||||
MsgSuccess(t('common.editSuccess'))
|
||||
|
|
|
|||
|
|
@ -313,7 +313,7 @@ import { t } from '@/locales'
|
|||
const route = useRoute()
|
||||
const { folder, user, tool } = useStore()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -327,11 +327,11 @@ const isShared = computed(() => {
|
|||
return folder.currentFolder.id === 'share'
|
||||
})
|
||||
const isSystemShare = computed(() => {
|
||||
return type.value === 'systemShare'
|
||||
return apiType.value === 'systemShare'
|
||||
})
|
||||
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['tool'][type.value]
|
||||
return permissionMap['tool'][apiType.value]
|
||||
})
|
||||
|
||||
const InitParamDrawerRef = ref()
|
||||
|
|
@ -370,7 +370,7 @@ function openCreateDialog(data?: any) {
|
|||
}
|
||||
ToolDrawertitle.value = data ? t('views.tool.editTool') : t('views.tool.createTool')
|
||||
if (data) {
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.getToolById(data?.id, loading)
|
||||
.then((res: any) => {
|
||||
ToolFormDrawerRef.value.open(res.data)
|
||||
|
|
@ -393,7 +393,7 @@ async function changeState(row: any) {
|
|||
const obj = {
|
||||
is_active: !row.is_active,
|
||||
}
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.putTool(row.id, obj, changeStateloading)
|
||||
.then(() => {
|
||||
const list = cloneDeep(tool.toolList)
|
||||
|
|
@ -407,7 +407,7 @@ async function changeState(row: any) {
|
|||
})
|
||||
})
|
||||
} else {
|
||||
const res = await loadSharedApi({ type: 'tool', systemType: type.value }).getToolById(
|
||||
const res = await loadSharedApi({ type: 'tool', systemType: apiType.value }).getToolById(
|
||||
row.id,
|
||||
changeStateloading,
|
||||
)
|
||||
|
|
@ -424,7 +424,7 @@ async function changeState(row: any) {
|
|||
const obj = {
|
||||
is_active: !row.is_active,
|
||||
}
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.putTool(row.id, obj, changeStateloading)
|
||||
.then(() => {
|
||||
const list = cloneDeep(tool.toolList)
|
||||
|
|
@ -462,7 +462,7 @@ function copyTool(row: any) {
|
|||
}
|
||||
|
||||
function exportTool(row: any) {
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.exportTool(row.id, row.name, loading)
|
||||
.catch((e: any) => {
|
||||
if (e.response.status !== 403) {
|
||||
|
|
@ -484,7 +484,7 @@ function deleteTool(row: any) {
|
|||
},
|
||||
)
|
||||
.then(() => {
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.delTool(row.id, loading)
|
||||
.then(() => {
|
||||
const list = cloneDeep(tool.toolList)
|
||||
|
|
@ -498,7 +498,7 @@ function deleteTool(row: any) {
|
|||
}
|
||||
|
||||
function configInitParams(item: any) {
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.getToolById(item?.id, changeStateloading)
|
||||
.then((res: any) => {
|
||||
InitParamDrawerRef.value.open(res.data)
|
||||
|
|
@ -517,7 +517,7 @@ function addInternalFunction(data?: any, isEdit?: boolean) {
|
|||
|
||||
function confirmAddInternalFunction(data?: any, isEdit?: boolean) {
|
||||
if (isEdit) {
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.putTool(data?.id as string, { name: data.name }, loading)
|
||||
.then((res: any) => {
|
||||
MsgSuccess(t('common.saveSuccess'))
|
||||
|
|
@ -531,7 +531,7 @@ function importTool(file: any) {
|
|||
const formData = new FormData()
|
||||
formData.append('file', file.raw, file.name)
|
||||
elUploadRef.value.clearFiles()
|
||||
loadSharedApi({ type: 'tool', systemType: type.value })
|
||||
loadSharedApi({ type: 'tool', systemType: apiType.value })
|
||||
.postImportTool(formData, loading)
|
||||
.then(async (res: any) => {
|
||||
if (res?.data) {
|
||||
|
|
@ -572,7 +572,7 @@ function getList() {
|
|||
[search_type.value]: search_form.value[search_type.value],
|
||||
}
|
||||
tool
|
||||
.asyncGetToolListPage(paginationConfig, isShared.value, type.value, params, loading)
|
||||
.asyncGetToolListPage(paginationConfig, isShared.value, apiType.value, params, loading)
|
||||
.then((res: any) => {
|
||||
paginationConfig.total = res.data?.total
|
||||
tool.setToolList([...tool.toolList, ...res.data?.records])
|
||||
|
|
@ -584,7 +584,7 @@ function clickFolder(item: any) {
|
|||
}
|
||||
|
||||
onMounted(() => {
|
||||
if (type.value !== 'workspace') {
|
||||
if (apiType.value !== 'workspace') {
|
||||
getList()
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import useStore from '@/stores'
|
|||
const route = useRoute()
|
||||
const { folder, tool } = useStore()
|
||||
|
||||
const type = computed(() => {
|
||||
const apiType = computed(() => {
|
||||
if (route.path.includes('shared')) {
|
||||
return 'systemShare'
|
||||
} else if (route.path.includes('resource-management')) {
|
||||
|
|
@ -41,7 +41,7 @@ const type = computed(() => {
|
|||
}
|
||||
})
|
||||
const permissionPrecise = computed(() => {
|
||||
return permissionMap['tool'][type.value]
|
||||
return permissionMap['tool'][apiType.value]
|
||||
})
|
||||
|
||||
const loading = ref(false)
|
||||
|
|
|
|||
Loading…
Reference in New Issue