Skip to content

Commit 7c560b4

Browse files
committed
fix(模型模态框): 为analysis-vl类型模型默认启用图片支持
修改ModelModal组件,当模型类型为analysis-vl时自动启用图片支持功能,并禁用相关复选框的修改。同时更新高级设置部分的显示逻辑,不再排除analysis-vl类型模型。
1 parent 0f79a5d commit 7c560b4

1 file changed

Lines changed: 45 additions & 34 deletions

File tree

ui/ModelModal/src/ModelModal.tsx

Lines changed: 45 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export const ModelModal: React.FC<ModelModalProps> = ({
8282
context_window_size: 64000,
8383
max_output_tokens: 8192,
8484
enable_r1_params: false,
85-
support_image: false,
85+
support_image: model_type === 'analysis-vl' ? true : false,
8686
support_compute: false,
8787
support_prompt_caching: false,
8888
},
@@ -119,7 +119,7 @@ export const ModelModal: React.FC<ModelModalProps> = ({
119119
context_window_size: 64000,
120120
max_output_tokens: 8192,
121121
enable_r1_params: false,
122-
support_image: false,
122+
support_image: model_type === 'analysis-vl' ? true : false,
123123
support_compute: false,
124124
support_prompt_caching: false,
125125
});
@@ -358,7 +358,7 @@ export const ModelModal: React.FC<ModelModalProps> = ({
358358
context_window_size: value.param?.context_window || 64000,
359359
max_output_tokens: value.param?.max_tokens || 8192,
360360
enable_r1_params: value.param?.r1_enabled || false,
361-
support_image: value.param?.support_images || false,
361+
support_image: model_type === 'analysis-vl' ? true : (value.param?.support_images || false),
362362
support_compute: value.param?.support_computer_use || false,
363363
support_prompt_caching: value.param?.support_prompt_cache || false,
364364
});
@@ -383,7 +383,7 @@ export const ModelModal: React.FC<ModelModalProps> = ({
383383
context_window_size: 64000,
384384
max_output_tokens: 8192,
385385
enable_r1_params: false,
386-
support_image: false,
386+
support_image: model_type === 'analysis-vl' ? true : false,
387387
support_compute: false,
388388
support_prompt_caching: false,
389389
});
@@ -537,7 +537,7 @@ export const ModelModal: React.FC<ModelModalProps> = ({
537537
context_window_size: 64000,
538538
max_output_tokens: 8192,
539539
enable_r1_params: false,
540-
support_image: false,
540+
support_image: model_type === 'analysis-vl' ? true : false,
541541
support_compute: false,
542542
support_prompt_caching: false,
543543
});
@@ -1038,9 +1038,9 @@ export const ModelModal: React.FC<ModelModalProps> = ({
10381038
)}
10391039
</>
10401040
)}
1041-
{/* 高级设置部分 - 在选择了模型或者是其它供应商时显示,但不包括embedding、rerank、reranker、analysis-vl 类型 */}
1041+
{/* 高级设置部分 - 在选择了模型或者是其它供应商时显示,但不包括embedding、rerank、reranker类型 */}
10421042
{(modelUserList.length !== 0 || providerBrand === 'Other') &&
1043-
!['embedding', 'rerank', 'reranker', 'analysis-vl'].includes(model_type) && (
1043+
!['embedding', 'rerank', 'reranker'].includes(model_type) && (
10441044
<Box sx={{ mt: 2 }}>
10451045
<Accordion
10461046
sx={{
@@ -1086,35 +1086,46 @@ export const ModelModal: React.FC<ModelModalProps> = ({
10861086
<Controller
10871087
control={control}
10881088
name='support_image'
1089-
render={({ field }) => (
1090-
<FormControlLabel
1091-
control={
1092-
<Checkbox
1093-
checked={field.value}
1094-
onChange={(e) =>
1095-
field.onChange(e.target.checked)
1096-
}
1097-
size='small'
1098-
/>
1099-
}
1100-
label={
1101-
<Box sx={{ fontSize: 12 }}>
1102-
启用图片
1103-
<Box
1104-
component='span'
1105-
sx={{
1106-
ml: 1,
1107-
color: 'text.secondary',
1108-
fontSize: 11,
1089+
render={({ field }) => {
1090+
const isAnalysisVl = model_type === 'analysis-vl';
1091+
const isChecked = isAnalysisVl ? true : field.value;
1092+
1093+
return (
1094+
<FormControlLabel
1095+
control={
1096+
<Checkbox
1097+
checked={isChecked}
1098+
onChange={(e) => {
1099+
if (!isAnalysisVl) {
1100+
field.onChange(e.target.checked);
1101+
}
11091102
}}
1110-
>
1111-
(支持图片输入的模型可以启用此选项)
1103+
disabled={isAnalysisVl}
1104+
size='small'
1105+
/>
1106+
}
1107+
label={
1108+
<Box sx={{ fontSize: 12 }}>
1109+
启用图片
1110+
<Box
1111+
component='span'
1112+
sx={{
1113+
ml: 1,
1114+
color: 'text.secondary',
1115+
fontSize: 11,
1116+
}}
1117+
>
1118+
{isAnalysisVl
1119+
? '(图像分析模型默认启用图片功能)'
1120+
: '(支持图片输入的模型可以启用此选项)'
1121+
}
1122+
</Box>
11121123
</Box>
1113-
</Box>
1114-
}
1115-
sx={{ margin: 0 }}
1116-
/>
1117-
)}
1124+
}
1125+
sx={{ margin: 0 }}
1126+
/>
1127+
);
1128+
}}
11181129
/>
11191130
<Controller
11201131
control={control}

0 commit comments

Comments
 (0)