Skip to content

Commit 0f79a5d

Browse files
authored
feat: 添加图像分析模型(analysis-vl)支持 (#80)
在模型类型解析、UI组件和配置中增加对analysis-vl类型的支持 更新模型选择菜单和高级设置逻辑以适配新模型类型 为所有模型提供商添加analysis_vl配置项
1 parent 1ce994e commit 0f79a5d

File tree

5 files changed

+47
-5
lines changed

5 files changed

+47
-5
lines changed

consts/consts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const (
2424

2525
func ParseModelType(s string) ModelType {
2626
switch s {
27-
case "llm", "chat", "analysis":
27+
case "llm", "chat", "analysis", "analysis-vl":
2828
return ModelTypeChat
2929
case "coder", "code":
3030
return ModelTypeCoder

test/ui_example/src/App.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ function App() {
112112
<MenuItem value={'audio'}>音频模型</MenuItem>
113113
<MenuItem value={'reranker'}>重排序模型</MenuItem>
114114
<MenuItem value={'analysis'}>分析模型</MenuItem>
115-
<MenuItem value={'monkeycode-chat'}>对话模型</MenuItem>
116-
<MenuItem value={'monkeycode-code'}>代码补全模型</MenuItem>
115+
<MenuItem value={'analysis-vl'}>图像分析模型</MenuItem>
117116
</Select>
118117
</FormControl>
119118
</Box>

ui/ModelModal/src/ModelModal.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const titleMap: Record<string, string> = {
3939
['rerank']: '重排序模型',
4040
['reranker']: '重排序模型',
4141
['analysis']: '分析模型',
42+
['analysis-vl']: '图像分析模型',
4243
};
4344

4445
export const ModelModal: React.FC<ModelModalProps> = ({
@@ -477,6 +478,8 @@ export const ModelModal: React.FC<ModelModalProps> = ({
477478
return it.rerank;
478479
case 'analysis':
479480
return it.analysis;
481+
case 'analysis-vl':
482+
return it.analysis_vl;
480483
default:
481484
return (
482485
it.label === 'BaiZhiCloud' || it.label === 'Other'
@@ -1035,9 +1038,9 @@ export const ModelModal: React.FC<ModelModalProps> = ({
10351038
)}
10361039
</>
10371040
)}
1038-
{/* 高级设置部分 - 在选择了模型或者是其它供应商时显示,但不包括embedding、rerank、reranker、analysis类型 */}
1041+
{/* 高级设置部分 - 在选择了模型或者是其它供应商时显示,但不包括embedding、rerank、reranker、analysis-vl 类型 */}
10391042
{(modelUserList.length !== 0 || providerBrand === 'Other') &&
1040-
!['embedding', 'rerank', 'reranker'].includes(model_type) && (
1043+
!['embedding', 'rerank', 'reranker', 'analysis-vl'].includes(model_type) && (
10411044
<Box sx={{ mt: 2 }}>
10421045
<Accordion
10431046
sx={{

ui/ModelModal/src/constants/providers.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
1414
embedding: true,
1515
rerank: true,
1616
analysis: true,
17+
analysis_vl: true,
1718
modelDocumentUrl: 'https://model-square.app.baizhi.cloud/token',
1819
defaultBaseUrl: 'https://model-square.app.baizhi.cloud/v1',
1920
},
@@ -29,6 +30,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
2930
embedding: false,
3031
rerank: false,
3132
analysis: true,
33+
analysis_vl: true,
3234
modelDocumentUrl: 'https://bigmodel.cn/usercenter/proj-mgmt/apikeys',
3335
defaultBaseUrl: 'https://open.bigmodel.cn/api/paas/v4',
3436
},
@@ -44,6 +46,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
4446
embedding: false,
4547
rerank: false,
4648
analysis: true,
49+
analysis_vl: true,
4750
modelDocumentUrl: 'https://platform.deepseek.com/api_keys',
4851
defaultBaseUrl: 'https://api.deepseek.com/v1',
4952
},
@@ -59,6 +62,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
5962
embedding: false,
6063
rerank: false,
6164
analysis: true,
65+
analysis_vl: true,
6266
modelDocumentUrl: 'https://console.cloud.tencent.com/hunyuan/api-key',
6367
defaultBaseUrl: 'https://api.hunyuan.cloud.tencent.com/v1',
6468
},
@@ -74,6 +78,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
7478
embedding: false,
7579
rerank: false,
7680
analysis: true,
81+
analysis_vl: true,
7782
modelDocumentUrl: 'https://bailian.console.aliyun.com/?tab=model#/api-key',
7883
defaultBaseUrl: 'https://dashscope.aliyuncs.com/compatible-mode/v1',
7984
},
@@ -89,6 +94,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
8994
embedding: false,
9095
rerank: false,
9196
analysis: true,
97+
analysis_vl: true,
9298
modelDocumentUrl: 'https://console.volcengine.com/ark/region:ark+cn-beijing/apiKey',
9399
defaultBaseUrl: 'https://ark.cn-beijing.volces.com/api/v3',
94100
},
@@ -104,6 +110,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
104110
embedding: false,
105111
rerank: false,
106112
analysis: true,
113+
analysis_vl: true,
107114
modelDocumentUrl: 'https://platform.openai.com/api-keys',
108115
defaultBaseUrl: 'https://api.openai.com/v1',
109116
},
@@ -119,6 +126,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
119126
embedding: false,
120127
rerank: false,
121128
analysis: true,
129+
analysis_vl: true,
122130
modelDocumentUrl: 'https://github.com/ollama/ollama/tree/main/docs',
123131
defaultBaseUrl: 'http://172.17.0.1:11434',
124132
},
@@ -134,6 +142,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
134142
embedding: false,
135143
rerank: false,
136144
analysis: true,
145+
analysis_vl: true,
137146
modelDocumentUrl: 'https://cloud.siliconflow.cn/me/account/ak',
138147
defaultBaseUrl: 'https://api.siliconflow.cn/v1',
139148
},
@@ -149,6 +158,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
149158
embedding: false,
150159
rerank: false,
151160
analysis: true,
161+
analysis_vl: true,
152162
modelDocumentUrl: 'https://platform.moonshot.cn/console/api-keys',
153163
defaultBaseUrl: 'https://api.moonshot.cn/v1',
154164
},
@@ -164,6 +174,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
164174
embedding: false,
165175
rerank: false,
166176
analysis: true,
177+
analysis_vl: true,
167178
modelDocumentUrl: 'https://portal.azure.com/#view/Microsoft_Azure_ProjectOxford/CognitiveServicesHub/~/OpenAI',
168179
defaultBaseUrl: 'https://<resource_name>.openai.azure.com',
169180
},
@@ -179,6 +190,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
179190
embedding: false,
180191
rerank: false,
181192
analysis: true,
193+
analysis_vl: true,
182194
modelDocumentUrl: 'https://aistudio.google.com/app/apikey',
183195
defaultBaseUrl: 'https://generativelanguage.googleapis.com',
184196
},
@@ -194,6 +206,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
194206
embedding: false,
195207
rerank: false,
196208
analysis: true,
209+
analysis_vl: true,
197210
modelDocumentUrl: 'https://portal.qiniu.com/ai-inference/api-key',
198211
defaultBaseUrl: 'https://api.qnaigc.com/v1',
199212
},
@@ -249,6 +262,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
249262
embedding: true,
250263
rerank: true,
251264
analysis: true,
265+
analysis_vl: true,
252266
modelDocumentUrl: 'https://inference.readthedocs.io/zh-cn/v1.2.0/getting_started/installation.html#installation',
253267
defaultBaseUrl: 'http://172.17.0.1:9997',
254268
},
@@ -264,6 +278,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
264278
embedding: true,
265279
rerank: true,
266280
analysis: true,
281+
analysis_vl: true,
267282
modelDocumentUrl: 'https://docs.gpustack.ai/latest/quickstart/',
268283
defaultBaseUrl: 'http://172.17.0.1',
269284
},
@@ -279,6 +294,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
279294
embedding: false,
280295
rerank: false,
281296
analysis: true,
297+
analysis_vl: true,
282298
modelDocumentUrl: 'https://platform.lingyiwanwu.com/apikeys',
283299
defaultBaseUrl: 'https://api.lingyiwanwu.com/v1',
284300
},
@@ -355,6 +371,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
355371
embedding: false,
356372
rerank: false,
357373
analysis: true,
374+
analysis_vl: true,
358375
modelDocumentUrl: 'https://huiju.ctyun.cn/service/serviceGroup',
359376
defaultBaseUrl: 'https://wishub-x1.ctyun.cn/v1',
360377
},
@@ -370,6 +387,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
370387
embedding: false,
371388
rerank: false,
372389
analysis: true,
390+
analysis_vl: true,
373391
modelDocumentUrl: 'https://console.cloud.tencent.com/lkeap/api',
374392
defaultBaseUrl: 'https://api.lkeap.cloud.tencent.com/v1',
375393
},
@@ -385,6 +403,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
385403
embedding: false,
386404
rerank: false,
387405
analysis: true,
406+
analysis_vl: true,
388407
modelDocumentUrl: 'https://console.bce.baidu.com/iam/#/iam/apikey/list',
389408
defaultBaseUrl: 'https://qianfan.baidubce.com/v2',
390409
},
@@ -400,6 +419,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
400419
embedding: false,
401420
rerank: false,
402421
analysis: false,
422+
analysis_vl: false,
403423
modelDocumentUrl: 'https://modelscope.cn/my/myaccesstoken',
404424
defaultBaseUrl: 'https://api-inference.modelscope.cn/v1',
405425
},
@@ -415,6 +435,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
415435
embedding: false,
416436
rerank: false,
417437
analysis: true,
438+
analysis_vl: true,
418439
modelDocumentUrl: 'https://cloud.infini-ai.com/iam/secret/key',
419440
defaultBaseUrl: 'https://cloud.infini-ai.com/maas/v1',
420441
},
@@ -430,6 +451,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
430451
embedding: false,
431452
rerank: false,
432453
analysis: false,
454+
analysis_vl: false,
433455
modelDocumentUrl: 'https://platform.stepfun.com/interface-key',
434456
defaultBaseUrl: 'https://api.stepfun.com/v1',
435457
},
@@ -445,6 +467,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
445467
embedding: false,
446468
rerank: false,
447469
analysis: false,
470+
analysis_vl: false,
448471
modelDocumentUrl: 'https://maas.lanyun.net/#/system/apiKey',
449472
defaultBaseUrl: 'https://maas-api.lanyun.net/v1',
450473
},
@@ -460,6 +483,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
460483
embedding: false,
461484
rerank: false,
462485
analysis: false,
486+
analysis_vl: false,
463487
modelDocumentUrl: ' https://www.alayanew.com/backend/register',
464488
defaultBaseUrl: 'https://deepseek.alayanew.com/v1',
465489
},
@@ -475,6 +499,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
475499
embedding: false,
476500
rerank: false,
477501
analysis: false,
502+
analysis_vl: false,
478503
modelDocumentUrl: 'https://ppio.com/settings/key-management',
479504
defaultBaseUrl: 'https://api.ppinfra.com/v3/openai',
480505
},
@@ -490,6 +515,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
490515
embedding: false,
491516
rerank: false,
492517
analysis: false,
518+
analysis_vl: false,
493519
modelDocumentUrl: 'https://aihubmix.com',
494520
defaultBaseUrl: 'https://aihubmix.com/v1',
495521
},
@@ -505,6 +531,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
505531
embedding: false,
506532
rerank: false,
507533
analysis: true,
534+
analysis_vl: true,
508535
modelDocumentUrl: 'https://one.ocoolai.com/token',
509536
defaultBaseUrl: 'https://api.ocoolai.com/v1',
510537
},
@@ -520,6 +547,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
520547
embedding: false,
521548
rerank: false,
522549
analysis: false,
550+
analysis_vl: false,
523551
modelDocumentUrl: 'https://www.dmxapi.cn/register',
524552
defaultBaseUrl: 'https://www.dmxapi.cn/v1',
525553
},
@@ -535,6 +563,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
535563
embedding: false,
536564
rerank: false,
537565
analysis: true,
566+
analysis_vl: true,
538567
modelDocumentUrl: 'https://ai.burncloud.com/console/token',
539568
defaultBaseUrl: 'https://ai.burncloud.com/v1',
540569
},
@@ -560,6 +589,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
560589
embedding: false,
561590
rerank: false,
562591
analysis: true,
592+
analysis_vl: true,
563593
modelDocumentUrl: 'https://build.nvidia.com/?integrate_nim=true&hosted_api=true&modal=integrate-nim',
564594
defaultBaseUrl: 'https://integrate.api.nvidia.com/v1',
565595
},
@@ -575,6 +605,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
575605
embedding: false,
576606
rerank: false,
577607
analysis: false,
608+
analysis_vl: false,
578609
modelDocumentUrl: 'https://tokenflux.ai/docs',
579610
defaultBaseUrl: 'https://tokenflux.ai/v1',
580611
},
@@ -590,6 +621,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
590621
embedding: false,
591622
rerank: false,
592623
analysis: true,
624+
analysis_vl: true,
593625
modelDocumentUrl: 'https://dash.302.ai/apis/list',
594626
defaultBaseUrl: 'https://api.302.ai/v1',
595627
},
@@ -605,6 +637,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
605637
embedding: false,
606638
rerank: false,
607639
analysis: false,
640+
analysis_vl: false,
608641
modelDocumentUrl: 'https://cephalon.cloud/api',
609642
defaultBaseUrl: 'https://cephalon.cloud/user-center/v1/model',
610643
},
@@ -620,6 +653,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
620653
embedding: false,
621654
rerank: false,
622655
analysis: false,
656+
analysis_vl: false,
623657
modelDocumentUrl: 'https://openrouter.ai/settings/keys',
624658
defaultBaseUrl: 'https://openrouter.ai/api/v1',
625659
},
@@ -635,6 +669,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
635669
embedding: false,
636670
rerank: false,
637671
analysis: true,
672+
analysis_vl: true,
638673
modelDocumentUrl: 'https://app.fireworks.ai/settings/users/api-keys',
639674
defaultBaseUrl: 'https://api.fireworks.ai/inference/v1',
640675
},
@@ -650,6 +685,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
650685
embedding: false,
651686
rerank: false,
652687
analysis: false,
688+
analysis_vl: false,
653689
modelDocumentUrl: 'https://console.mistral.ai/api-keys/',
654690
defaultBaseUrl: 'https://api.mistral.ai/v1',
655691
},
@@ -665,6 +701,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
665701
embedding: false,
666702
rerank: false,
667703
analysis: false,
704+
analysis_vl: false,
668705
modelDocumentUrl: 'https://www.perplexity.ai/settings/api',
669706
defaultBaseUrl: 'https://api.perplexity.ai',
670707
},
@@ -680,6 +717,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
680717
embedding: false,
681718
rerank: false,
682719
analysis: false,
720+
analysis_vl: false,
683721
modelDocumentUrl: 'https://app.hyperbolic.xyz/settings',
684722
defaultBaseUrl: 'https://api.hyperbolic.xyz/v1',
685723
},
@@ -715,6 +753,7 @@ export const DEFAULT_MODEL_PROVIDERS: ModelProviderMap = {
715753
embedding: true,
716754
rerank: true,
717755
analysis: true,
756+
analysis_vl: true,
718757
modelDocumentUrl: '',
719758
defaultBaseUrl: '',
720759
},

ui/ModelModal/src/types/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export interface ModelProviderConfig {
5858
embedding: boolean;
5959
rerank: boolean;
6060
analysis: boolean;
61+
analysis_vl: boolean;
6162
modelDocumentUrl?: string;
6263
defaultBaseUrl: string;
6364
}

0 commit comments

Comments
 (0)