fix: playground edit message

This commit is contained in:
jialin
2024-09-25 16:17:25 +08:00
parent 3cd96ba2e8
commit a698c65a07
32 changed files with 338 additions and 190 deletions
@@ -47,6 +47,8 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
setGlobalParams,
setLoadingStatus,
handleDeleteModel,
handleApplySystemChangeToAll,
modelFullList,
loadingStatus
} = useContext(CompareContext);
const intl = useIntl();
@@ -224,7 +226,7 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
isApplyToAllModels.current = e.target.checked;
if (e.target.checked) {
setGlobalParams({
...params
..._.omit(params, 'model')
});
}
};
@@ -289,10 +291,10 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
};
const modelOptions = useMemo(() => {
return modelList.filter((item) => {
return modelFullList.filter((item) => {
return item.type !== 'empty';
});
}, [modelList]);
}, [modelFullList]);
useEffect(() => {
console.log('globalParams:', globalParams.model, globalParams);
@@ -326,9 +328,9 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
<div className="header">
<span className="title">
<Select
style={{ minWidth: '100px' }}
style={{ minWidth: '120px' }}
variant="borderless"
options={modelOptions}
options={modelFullList}
onChange={handleModelChange}
value={params.model}
></Select>
@@ -379,7 +381,9 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
title={
<div>
<Checkbox onChange={handleApplyToAllModels}>
Apply to all models
{intl.formatMessage({
id: 'playground.compare.applytoall'
})}
</Checkbox>
</div>
}
@@ -401,7 +405,9 @@ const ModelItem: React.FC<ModelItemProps> = forwardRef(
</span>
</div>
<SystemMessage
showApplyToAll={true}
systemMessage={systemMessage}
applyToAll={handleApplySystemChangeToAll}
setSystemMessage={setSystemMessage}
></SystemMessage>
<SimpleBar style={{ maxHeight: maxHeight }}>