diff --git a/ui/src/api/system-resource-management/application.ts b/ui/src/api/system-resource-management/application.ts index 6f62d4d14..813f7393c 100644 --- a/ui/src/api/system-resource-management/application.ts +++ b/ui/src/api/system-resource-management/application.ts @@ -3,7 +3,6 @@ import {get, post, postStream, del, put, request, download, exportFile} from '@/ import type {pageRequest} from '@/api/type/common' import type {ApplicationFormType} from '@/api/type/application' import {type Ref} from 'vue' -import useStore from '@/stores' const prefix = '/system/resource/application' diff --git a/ui/src/api/system-resource-management/model.ts b/ui/src/api/system-resource-management/model.ts index 6d35da394..2a82a1da0 100644 --- a/ui/src/api/system-resource-management/model.ts +++ b/ui/src/api/system-resource-management/model.ts @@ -30,9 +30,10 @@ const getModelListPage: ( */ const getSelectModelList: ( data?: ListModelRequest, + workspace_id?: string, loading?: Ref, -) => Promise>> = (data, loading) => { - return get(`${prefix}/model_list`, data, loading).then((ok) => { +) => Promise>> = (data, workspace_id, loading) => { + return get(`${prefix}/workspace/${workspace_id}/model/model_list`, data, loading).then((ok) => { return { ...ok, data: [ diff --git a/ui/src/api/system-resource-management/paragraph.ts b/ui/src/api/system-resource-management/paragraph.ts index 9b26f1357..33fd5a1e4 100644 --- a/ui/src/api/system-resource-management/paragraph.ts +++ b/ui/src/api/system-resource-management/paragraph.ts @@ -288,4 +288,5 @@ export default { putBatchGenerateRelated, putMigrateMulParagraph, putDisassociationProblem, + putAdjustPosition, } diff --git a/ui/src/api/system-shared/paragraph.ts b/ui/src/api/system-shared/paragraph.ts index 785e4381b..c8291bd89 100644 --- a/ui/src/api/system-shared/paragraph.ts +++ b/ui/src/api/system-shared/paragraph.ts @@ -288,4 +288,5 @@ export default { putBatchGenerateRelated, putMigrateMulParagraph, putDisassociationProblem, + putAdjustPosition, } diff --git a/ui/src/components/app-icon/icons/system.ts b/ui/src/components/app-icon/icons/system.ts index 44bbf89ca..b54b6c5b5 100644 --- a/ui/src/components/app-icon/icons/system.ts +++ b/ui/src/components/app-icon/icons/system.ts @@ -40,4 +40,24 @@ export default { ]) }, }, + 'app-admin-operation': { + iconReader: () => { + return h('i', [ + h( + 'svg', + { + viewBox: '0 0 1024 1024', + version: '1.1', + xmlns: 'http://www.w3.org/2000/svg', + }, + [ + h('path', { + d: 'M805.290667 298.666667a170.752 170.752 0 0 1-330.581334 0H112.682667c-9.514667 0-12.970667-1.024-16.426667-2.858667a19.370667 19.370667 0 0 1-8.106667-8.106667C86.357333 284.330667 85.333333 280.832 85.333333 271.36V240.64c0-9.472 0.981333-12.928 2.858667-16.426667a19.370667 19.370667 0 0 1 8.064-8.064C99.712 214.314667 103.168 213.333333 112.64 213.333333h362.026667a170.752 170.752 0 0 1 330.581333 0h106.026667c9.514667 0 12.970667 0.981333 16.426666 2.816a19.370667 19.370667 0 0 1 8.106667 8.106667c1.834667 3.413333 2.816 6.912 2.816 16.384v30.677333c0 9.472-0.981333 12.928-2.858667 16.426667a19.370667 19.370667 0 0 1-8.064 8.064c-3.456 1.834667-6.912 2.858667-16.426666 2.858667h-106.026667zM640 341.333333a85.333333 85.333333 0 1 0 0-170.666666 85.333333 85.333333 0 0 0 0 170.666666zM549.290667 810.666667a170.752 170.752 0 0 1-330.581334 0H112.682667c-9.514667 0-12.970667-1.024-16.426667-2.858667a19.370667 19.370667 0 0 1-8.106667-8.106667c-1.834667-3.413333-2.816-6.912-2.816-16.384v-30.677333c0-9.472 0.981333-12.928 2.858667-16.426667a19.370667 19.370667 0 0 1 8.064-8.064c3.456-1.834667 6.912-2.816 16.426667-2.816h106.026666a170.752 170.752 0 0 1 330.581334 0h362.026666c9.514667 0 12.970667 0.981333 16.426667 2.816a19.370667 19.370667 0 0 1 8.106667 8.106667c1.834667 3.413333 2.816 6.912 2.816 16.384v30.634667c0 9.514667-0.981333 12.970667-2.858667 16.469333a19.370667 19.370667 0 0 1-8.064 8.064c-3.456 1.834667-6.912 2.858667-16.426667 2.858667h-362.026666zM384 853.333333a85.333333 85.333333 0 1 0 0-170.666666 85.333333 85.333333 0 0 0 0 170.666666z', + fill: 'currentColor', + }), + ], + ), + ]) + }, + }, } diff --git a/ui/src/components/generate-related-dialog/index.vue b/ui/src/components/generate-related-dialog/index.vue index 27faa22bc..31c760309 100644 --- a/ui/src/components/generate-related-dialog/index.vue +++ b/ui/src/components/generate-related-dialog/index.vue @@ -77,6 +77,7 @@ import { groupBy } from 'lodash' import { MsgSuccess } from '@/utils/message' import { t } from '@/locales' import type { FormInstance } from 'element-plus' +import modelResourceApi from '@/api/system-resource-management/model' import { loadSharedApi } from '@/utils/dynamics-api/shared-api' const props = defineProps<{ @@ -104,7 +105,7 @@ const stateMap = { error: ['0', '1', '3', '4', '5', 'n'], } const FormRef = ref() -const knowledgeId = ref() +const currentKnowledge = ref(null) const userId = user.userInfo?.id as string const form = ref(prompt.get(userId)) const rules = reactive({ @@ -131,8 +132,8 @@ watch(dialogVisible, (bool) => { } }) -const open = (ids: string[], type: string, _knowledgeId?: string) => { - knowledgeId.value = _knowledgeId +const open = (ids: string[], type: string, _knowledge?: any) => { + currentKnowledge.value = _knowledge getModelFn() idList.value = ids apiSubmitType.value = type @@ -178,7 +179,7 @@ const submitHandle = async (formEl: FormInstance) => { state_list: stateMap[state.value], } loadSharedApi({ type: 'knowledge', systemType: props.apiType }) - .putGenerateRelated(id ? id : knowledgeId.value, data, loading) + .putGenerateRelated(id ? id : currentKnowledge.value?.id, data, loading) .then(() => { MsgSuccess(t('views.document.generateQuestion.successMessage')) dialogVisible.value = false @@ -190,15 +191,27 @@ const submitHandle = async (formEl: FormInstance) => { function getModelFn() { loading.value = true - loadSharedApi({ type: 'model', systemType: props.apiType }) - .getSelectModelList({ model_type: 'LLM' }) - .then((res: any) => { - modelOptions.value = groupBy(res?.data, 'provider') - loading.value = false - }) - .catch(() => { - loading.value = false - }) + if (props.apiType === 'systemManage') { + modelResourceApi + .getSelectModelList({ model_type: 'LLM' }, currentKnowledge.value?.workspace_id) + .then((res: any) => { + modelOptions.value = groupBy(res?.data, 'provider') + loading.value = false + }) + .catch(() => { + loading.value = false + }) + } else { + loadSharedApi({ type: 'model', systemType: props.apiType }) + .getSelectModelList({ model_type: 'LLM' }) + .then((res: any) => { + modelOptions.value = groupBy(res?.data, 'provider') + loading.value = false + }) + .catch(() => { + loading.value = false + }) + } } defineExpose({ open, dialogVisible }) diff --git a/ui/src/layout/components/breadcrumb/index.vue b/ui/src/layout/components/breadcrumb/index.vue index b45c73992..1b0e9c59d 100644 --- a/ui/src/layout/components/breadcrumb/index.vue +++ b/ui/src/layout/components/breadcrumb/index.vue @@ -36,13 +36,13 @@ const route = useRoute() const { meta: { activeMenu }, params: { id, folderId }, - query: { isShared }, + query: { isShared, type }, } = route as any const apiType = computed(() => { if (route.path.includes('shared')) { return 'systemShare' - } else if (route.path.includes('resource-management')) { + } else if (route.path.includes('resource-management') || type === 'systemManage') { return 'systemManage' } else { return 'workspace' @@ -71,7 +71,7 @@ const isKnowledge = computed(() => { const toBackPath = computed(() => { if (route.path.includes('shared')) { return '/system/shared' + activeMenu - } else if (route.path.includes('resource-management')) { + } else if (route.path.includes('resource-management') || type === 'systemManage') { return '/system/resource-management' + activeMenu } else { return activeMenu diff --git a/ui/src/layout/layout-template/MainLayout.vue b/ui/src/layout/layout-template/MainLayout.vue index 6a8f4cce1..752b9173b 100644 --- a/ui/src/layout/layout-template/MainLayout.vue +++ b/ui/src/layout/layout-template/MainLayout.vue @@ -36,7 +36,7 @@ const { query: { type }, } = route as any const isShared = computed(() => { - return folderId === 'shared' || type === 'systemShare' + return folderId === 'shared' || type === 'systemShare' || type === 'systemManage' }) const { theme, user } = useStore() const isDefaultTheme = computed(() => { diff --git a/ui/src/layout/layout-template/SimpleLayout.vue b/ui/src/layout/layout-template/SimpleLayout.vue index 99c833ec5..32a80a35d 100644 --- a/ui/src/layout/layout-template/SimpleLayout.vue +++ b/ui/src/layout/layout-template/SimpleLayout.vue @@ -15,7 +15,7 @@ const { query: { type }, } = route as any const isShared = computed(() => { - return folderId === 'shared' || type === 'systemShare' + return folderId === 'shared' || type === 'systemShare' || type === 'systemManage' }) diff --git a/ui/src/locales/lang/en-US/views/system.ts b/ui/src/locales/lang/en-US/views/system.ts index 2aad03842..8b2efe24f 100644 --- a/ui/src/locales/lang/en-US/views/system.ts +++ b/ui/src/locales/lang/en-US/views/system.ts @@ -114,7 +114,7 @@ export default { member: 'Member', permissionSetting: 'Permission Setting', setting: { - management: ' management', + management: 'management', check: 'check', authorization: 'authorization', }, @@ -126,5 +126,6 @@ export default { resource_management: { label: 'Resource Management', type: 'Type', + management: 'management', }, } diff --git a/ui/src/locales/lang/zh-CN/views/system.ts b/ui/src/locales/lang/zh-CN/views/system.ts index df0f78c69..666d0874f 100644 --- a/ui/src/locales/lang/zh-CN/views/system.ts +++ b/ui/src/locales/lang/zh-CN/views/system.ts @@ -126,5 +126,6 @@ export default { resource_management: { label: '资源管理', type: '类型', + management: '管理', }, } diff --git a/ui/src/locales/lang/zh-Hant/views/system.ts b/ui/src/locales/lang/zh-Hant/views/system.ts index 0ee05acb8..1527b507e 100644 --- a/ui/src/locales/lang/zh-Hant/views/system.ts +++ b/ui/src/locales/lang/zh-Hant/views/system.ts @@ -125,6 +125,7 @@ export default { }, resource_management: { label: '資源管理', - type: '类型', + type: '類型', + management: '管理', }, } diff --git a/ui/src/router/modules/knowledge.ts b/ui/src/router/modules/knowledge.ts index c63995ebc..939a1969c 100644 --- a/ui/src/router/modules/knowledge.ts +++ b/ui/src/router/modules/knowledge.ts @@ -34,7 +34,7 @@ const ModelRouter = { hidden: true, }, { - path: '/knowledge/import', + path: '/knowledge/import/:folderId', name: 'ImportLarkDocument', meta: { activeMenu: '/knowledge' }, component: () => import('@/views/document/ImportLarkDocument.vue'), diff --git a/ui/src/utils/dynamics-api/shared-api.ts b/ui/src/utils/dynamics-api/shared-api.ts index bdf548b08..d72a7d087 100644 --- a/ui/src/utils/dynamics-api/shared-api.ts +++ b/ui/src/utils/dynamics-api/shared-api.ts @@ -16,6 +16,11 @@ import chatUserSystemShareApi from '@/api/system-shared/chat-user' import workspaceApi from '@/api/workspace/workspace' import systemUserApi from '@/api/user/user' import ToolResourceApi from '@/api/system-resource-management/tool' +import knowledgeResourceApi from '@/api/system-resource-management/knowledge' +import documentResourceApi from '@/api/system-resource-management/document' +import paragraphResourceApi from '@/api/system-resource-management/paragraph' +import problemResourceApi from '@/api/system-resource-management/problem' +import modelResourceApi from '@/api/system-resource-management/model' // 普通 API const workspaceApiMap = { @@ -43,8 +48,11 @@ const systemShareApiMap = { // 资源管理 API const systemManageApiMap = { - // knowledge: knowledgeWorkspaceApi, - // model: modelWorkspaceApi, + knowledge: knowledgeResourceApi, + document: documentResourceApi, + paragraph: paragraphResourceApi, + problem: problemResourceApi, + model: modelResourceApi, tool: ToolResourceApi, } as any @@ -52,7 +60,7 @@ const data = { systemShare: systemShareApiMap, workspace: workspaceApiMap, systemManage: systemManageApiMap, - workspaceShare: workspaceApiMap + workspaceShare: workspaceApiMap, } /** 动态导入 API 模块的函数 * loadSharedApi('knowledge', true,'systemShare') diff --git a/ui/src/views/document/component/ImportDocumentDialog.vue b/ui/src/views/document/component/ImportDocumentDialog.vue index 3ab1b840e..22b0b824d 100644 --- a/ui/src/views/document/component/ImportDocumentDialog.vue +++ b/ui/src/views/document/component/ImportDocumentDialog.vue @@ -219,7 +219,7 @@ const submit = async (formEl: FormInstance | undefined) => { ...{ source_url: form.value.source_url, selector: form.value.selector, - } + }, }, } loadSharedApi({ type: 'document', systemType: apiType.value }) diff --git a/ui/src/views/document/index.vue b/ui/src/views/document/index.vue index d76f63be5..b605f0689 100644 --- a/ui/src/views/document/index.vue +++ b/ui/src/views/document/index.vue @@ -29,7 +29,7 @@ type="primary" @click=" router.push({ - path: `/knowledge/import`, + path: `/knowledge/import/${folderId}`, query: { id: id, folder_token: knowledgeDetail?.meta.folder_token, @@ -56,9 +56,7 @@ v-if="permissionPrecise.doc_migrate(id)" >{{ $t('views.document.setting.migration') }} - + @@ -422,9 +420,7 @@ - + @@ -535,9 +531,7 @@ - + @@ -704,22 +698,32 @@ const permissionPrecise = computed(() => { }) const MoreFilledPermission0 = (id: string) => { - return permissionPrecise.value.doc_edit(id) || - (knowledgeDetail?.value.type === 1 && permissionPrecise.value.doc_sync(id)) || - (knowledgeDetail?.value.type === 2 && permissionPrecise.value.doc_sync(id)) || - permissionPrecise.value.doc_delete(id) + return ( + permissionPrecise.value.doc_edit(id) || + (knowledgeDetail?.value.type === 1 && permissionPrecise.value.doc_sync(id)) || + (knowledgeDetail?.value.type === 2 && permissionPrecise.value.doc_sync(id)) || + permissionPrecise.value.doc_delete(id) + ) } const MoreFilledPermission1 = (id: string) => { - return permissionPrecise.value.doc_generate(id) || permissionPrecise.value.doc_migrate(id) || - permissionPrecise.value.doc_export(id) || permissionPrecise.value.doc_download(id) || - permissionPrecise.value.doc_delete(id) + return ( + permissionPrecise.value.doc_generate(id) || + permissionPrecise.value.doc_migrate(id) || + permissionPrecise.value.doc_export(id) || + permissionPrecise.value.doc_download(id) || + permissionPrecise.value.doc_delete(id) + ) } const MoreFilledPermission2 = (id: string) => { - return permissionPrecise.value.doc_edit(id) || permissionPrecise.value.doc_generate(id) || - permissionPrecise.value.doc_migrate(id) || permissionPrecise.value.doc_export(id) || - permissionPrecise.value.doc_delete(id) + return ( + permissionPrecise.value.doc_edit(id) || + permissionPrecise.value.doc_generate(id) || + permissionPrecise.value.doc_migrate(id) || + permissionPrecise.value.doc_export(id) || + permissionPrecise.value.doc_delete(id) + ) } const getTaskState = (status: string, taskType: number) => { diff --git a/ui/src/views/document/upload/ResultSuccess.vue b/ui/src/views/document/upload/ResultSuccess.vue index bb3a77183..c62ddc678 100644 --- a/ui/src/views/document/upload/ResultSuccess.vue +++ b/ui/src/views/document/upload/ResultSuccess.vue @@ -17,12 +17,19 @@