Skip to content

Commit 03fbba0

Browse files
feat: knowledge resource management and model resource management
1 parent 5022b2a commit 03fbba0

File tree

28 files changed

+395
-83
lines changed

28 files changed

+395
-83
lines changed

ui/src/api/system-resource-management/application.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import {get, post, postStream, del, put, request, download, exportFile} from '@/
33
import type {pageRequest} from '@/api/type/common'
44
import type {ApplicationFormType} from '@/api/type/application'
55
import {type Ref} from 'vue'
6-
import useStore from '@/stores'
76

87
const prefix = '/system/resource/application'
98

ui/src/api/system-resource-management/model.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ const getModelListPage: (
3030
*/
3131
const getSelectModelList: (
3232
data?: ListModelRequest,
33+
workspace_id?: string,
3334
loading?: Ref<boolean>,
34-
) => Promise<Result<Array<Model>>> = (data, loading) => {
35-
return get(`${prefix}/model_list`, data, loading).then((ok) => {
35+
) => Promise<Result<Array<Model>>> = (data, workspace_id, loading) => {
36+
return get(`${prefix}/workspace/${workspace_id}/model/model_list`, data, loading).then((ok) => {
3637
return {
3738
...ok,
3839
data: [

ui/src/api/system-resource-management/paragraph.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,5 @@ export default {
288288
putBatchGenerateRelated,
289289
putMigrateMulParagraph,
290290
putDisassociationProblem,
291+
putAdjustPosition,
291292
}

ui/src/api/system-shared/paragraph.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,4 +288,5 @@ export default {
288288
putBatchGenerateRelated,
289289
putMigrateMulParagraph,
290290
putDisassociationProblem,
291+
putAdjustPosition,
291292
}

ui/src/components/app-icon/icons/system.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,24 @@ export default {
4040
])
4141
},
4242
},
43+
'app-admin-operation': {
44+
iconReader: () => {
45+
return h('i', [
46+
h(
47+
'svg',
48+
{
49+
viewBox: '0 0 1024 1024',
50+
version: '1.1',
51+
xmlns: 'http://www.w3.org/2000/svg',
52+
},
53+
[
54+
h('path', {
55+
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',
56+
fill: 'currentColor',
57+
}),
58+
],
59+
),
60+
])
61+
},
62+
},
4363
}

ui/src/components/generate-related-dialog/index.vue

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ import { groupBy } from 'lodash'
7777
import { MsgSuccess } from '@/utils/message'
7878
import { t } from '@/locales'
7979
import type { FormInstance } from 'element-plus'
80+
import modelResourceApi from '@/api/system-resource-management/model'
8081
import { loadSharedApi } from '@/utils/dynamics-api/shared-api'
8182
8283
const props = defineProps<{
@@ -104,7 +105,7 @@ const stateMap = {
104105
error: ['0', '1', '3', '4', '5', 'n'],
105106
}
106107
const FormRef = ref()
107-
const knowledgeId = ref<string>()
108+
const currentKnowledge = ref<any>(null)
108109
const userId = user.userInfo?.id as string
109110
const form = ref(prompt.get(userId))
110111
const rules = reactive({
@@ -131,8 +132,8 @@ watch(dialogVisible, (bool) => {
131132
}
132133
})
133134
134-
const open = (ids: string[], type: string, _knowledgeId?: string) => {
135-
knowledgeId.value = _knowledgeId
135+
const open = (ids: string[], type: string, _knowledge?: any) => {
136+
currentKnowledge.value = _knowledge
136137
getModelFn()
137138
idList.value = ids
138139
apiSubmitType.value = type
@@ -178,7 +179,7 @@ const submitHandle = async (formEl: FormInstance) => {
178179
state_list: stateMap[state.value],
179180
}
180181
loadSharedApi({ type: 'knowledge', systemType: props.apiType })
181-
.putGenerateRelated(id ? id : knowledgeId.value, data, loading)
182+
.putGenerateRelated(id ? id : currentKnowledge.value?.id, data, loading)
182183
.then(() => {
183184
MsgSuccess(t('views.document.generateQuestion.successMessage'))
184185
dialogVisible.value = false
@@ -190,15 +191,27 @@ const submitHandle = async (formEl: FormInstance) => {
190191
191192
function getModelFn() {
192193
loading.value = true
193-
loadSharedApi({ type: 'model', systemType: props.apiType })
194-
.getSelectModelList({ model_type: 'LLM' })
195-
.then((res: any) => {
196-
modelOptions.value = groupBy(res?.data, 'provider')
197-
loading.value = false
198-
})
199-
.catch(() => {
200-
loading.value = false
201-
})
194+
if (props.apiType === 'systemManage') {
195+
modelResourceApi
196+
.getSelectModelList({ model_type: 'LLM' }, currentKnowledge.value?.workspace_id)
197+
.then((res: any) => {
198+
modelOptions.value = groupBy(res?.data, 'provider')
199+
loading.value = false
200+
})
201+
.catch(() => {
202+
loading.value = false
203+
})
204+
} else {
205+
loadSharedApi({ type: 'model', systemType: props.apiType })
206+
.getSelectModelList({ model_type: 'LLM' })
207+
.then((res: any) => {
208+
modelOptions.value = groupBy(res?.data, 'provider')
209+
loading.value = false
210+
})
211+
.catch(() => {
212+
loading.value = false
213+
})
214+
}
202215
}
203216
204217
defineExpose({ open, dialogVisible })

ui/src/layout/components/breadcrumb/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ const route = useRoute()
3636
const {
3737
meta: { activeMenu },
3838
params: { id, folderId },
39-
query: { isShared },
39+
query: { isShared, type },
4040
} = route as any
4141
4242
const apiType = computed(() => {
4343
if (route.path.includes('shared')) {
4444
return 'systemShare'
45-
} else if (route.path.includes('resource-management')) {
45+
} else if (route.path.includes('resource-management') || type === 'systemManage') {
4646
return 'systemManage'
4747
} else {
4848
return 'workspace'
@@ -71,7 +71,7 @@ const isKnowledge = computed(() => {
7171
const toBackPath = computed(() => {
7272
if (route.path.includes('shared')) {
7373
return '/system/shared' + activeMenu
74-
} else if (route.path.includes('resource-management')) {
74+
} else if (route.path.includes('resource-management') || type === 'systemManage') {
7575
return '/system/resource-management' + activeMenu
7676
} else {
7777
return activeMenu

ui/src/layout/layout-template/MainLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const {
3636
query: { type },
3737
} = route as any
3838
const isShared = computed(() => {
39-
return folderId === 'shared' || type === 'systemShare'
39+
return folderId === 'shared' || type === 'systemShare' || type === 'systemManage'
4040
})
4141
const { theme, user } = useStore()
4242
const isDefaultTheme = computed(() => {

ui/src/layout/layout-template/SimpleLayout.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const {
1515
query: { type },
1616
} = route as any
1717
const isShared = computed(() => {
18-
return folderId === 'shared' || type === 'systemShare'
18+
return folderId === 'shared' || type === 'systemShare' || type === 'systemManage'
1919
})
2020
</script>
2121

ui/src/locales/lang/en-US/views/system.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default {
114114
member: 'Member',
115115
permissionSetting: 'Permission Setting',
116116
setting: {
117-
management: ' management',
117+
management: 'management',
118118
check: 'check',
119119
authorization: 'authorization',
120120
},
@@ -126,5 +126,6 @@ export default {
126126
resource_management: {
127127
label: 'Resource Management',
128128
type: 'Type',
129+
management: 'management',
129130
},
130131
}

0 commit comments

Comments
 (0)