22 <LayoutContainer header =" 模型设置" >
33 <div class =" template-manage flex main-calc-height" >
44 <div class =" template-manage__left p-8 border-r" >
5- <h4 class = " p-16 " style =" padding-bottom : 8px " >供应商</h4 >
5+ <h4 style =" padding-bottom : 8px " >供应商</h4 >
66 <div class =" model-list-height-left" >
7+ <ul class =" mb-8" >
8+ <li @click =" clickListHandle" class =" cursor" >
9+ <div class =" flex" >
10+ <AppIcon
11+ class =" mr-8"
12+ style =" height : 20px ; width : 20px "
13+ :iconName =" 'app-all-menu-active'"
14+ ></AppIcon >
15+ <span >全部模型</span >
16+ </div >
17+ </li >
18+ </ul >
719 <el-scrollbar >
8- <common-list
9- :data =" provider_list"
10- v-loading =" loading"
11- @click =" clickListHandle"
12- value-key =" provider"
13- default-active =" "
14- style =" overflow-y : auto "
15- >
16- <template #default =" { row , index } " >
17- <div class =" flex" v-if =" index === 0" >
18- <AppIcon
19- class =" mr-8"
20- style =" height : 20px ; width : 20px "
21- :iconName =" active_provider === row ? 'app-all-menu-active' : 'app-all-menu'"
22- ></AppIcon >
23- <span >全部模型</span >
24- </div >
25- <div class =" flex" v-else >
26- <span
27- :innerHTML =" row.icon"
28- alt =" "
29- style =" height : 20px ; width : 20px "
30- class =" mr-8"
31- />
32- <span >{{ row.name }}</span >
33- </div >
34- </template >
35- </common-list >
20+ <el-collapse >
21+ <el-collapse-item title =" 在线模型" name =" 1" >
22+ <template #title >
23+ <el-icon class =" mr-4" >
24+ <Folder />
25+ </el-icon >
26+ 在线模型
27+ </template >
28+ <common-list
29+ :data =" online_provider_list"
30+ v-loading =" loading"
31+ @click =" clickListHandle"
32+ value-key =" provider"
33+ default-active =" "
34+ style =" overflow-y : auto "
35+ >
36+ <template #default =" { row } " >
37+ <div class =" flex" >
38+ <span
39+ :innerHTML =" row.icon"
40+ alt =" "
41+ style =" height : 20px ; width : 20px "
42+ class =" mr-8"
43+ />
44+ <span >{{ row.name }}</span >
45+ </div >
46+ </template >
47+ </common-list >
48+ </el-collapse-item >
49+ <el-collapse-item title =" 私有模型" name =" 2" >
50+ <template #title >
51+ <el-icon class =" mr-4" >
52+ <Folder />
53+ </el-icon >
54+ 私有模型
55+ </template >
56+ <common-list
57+ :data =" local_provider_list"
58+ v-loading =" loading"
59+ @click =" clickListHandle"
60+ value-key =" provider"
61+ default-active =" "
62+ style =" overflow-y : auto "
63+ >
64+ <template #default =" { row } " >
65+ <div class =" flex" >
66+ <span
67+ :innerHTML =" row.icon"
68+ alt =" "
69+ style =" height : 20px ; width : 20px "
70+ class =" mr-8"
71+ />
72+ <span >{{ row.name }}</span >
73+ </div >
74+ </template >
75+ </common-list >
76+ </el-collapse-item >
77+ </el-collapse >
3678 </el-scrollbar >
3779 </div >
3880 </div >
5799 style =" max-width : 240px "
58100 clearable
59101 />
60- <el-select v-else-if =" search_type === 'create_user'" v-model =" model_search_form.create_user" @change =" list_model"
102+ <el-select v-else-if =" search_type === 'create_user'" v-model =" model_search_form.create_user"
103+ @change =" list_model"
61104 clearable >
62105 <el-option v-for =" u in user_options" :key =" u.id" :value =" u.id" :label =" u.username" />
63106 </el-select >
@@ -152,6 +195,8 @@ const model_search_form = ref<{ name: string, create_user: string, permission_ty
152195const user_options = ref <any []>([])
153196const list_model_loading = ref <boolean >(false )
154197const provider_list = ref <Array <Provider >>([])
198+ const online_provider_list = ref <Array <Provider >>([])
199+ const local_provider_list = ref <Array <Provider >>([])
155200
156201const model_list = ref <Array <Model >>([])
157202
@@ -186,7 +231,7 @@ const list_model = () => {
186231 ModelApi .getModel ({ ... model_search_form .value , ... params }, list_model_loading ).then ((ok ) => {
187232 model_list .value = ok .data
188233 const v = model_list .value .map ((m ) => ({ id: m .user_id , username: m .username }))
189- if (user_options .value .length === 0 ){
234+ if (user_options .value .length === 0 ) {
190235 user_options .value = Array .from (
191236 new Map (v .map (item => [item .id , item ])).values ()
192237 )
@@ -203,6 +248,17 @@ onMounted(() => {
203248 ModelApi .getProvider (loading ).then ((ok ) => {
204249 active_provider .value = allObj
205250 provider_list .value = [allObj , ... ok .data ]
251+
252+ const local_provider = [' model_ollama_provider' , ' model_local_provider' , ' model_xinference_provider' , ' model_vllm_provider' ]
253+ ok .data .forEach ((item ) => {
254+ if (local_provider .indexOf (item .provider ) > - 1 ) {
255+ local_provider_list .value .push (item )
256+ } else {
257+ online_provider_list .value .push (item )
258+ }
259+ })
260+ online_provider_list .value .sort ((a , b ) => a .provider .localeCompare (b .provider ))
261+ local_provider_list .value .sort ((a , b ) => a .provider .localeCompare (b .provider ))
206262 list_model ()
207263 })
208264})
0 commit comments