chore: image size tooltips
This commit is contained in:
@@ -100,6 +100,10 @@ const options = [
|
||||
{
|
||||
label: '--image-vae-tiling',
|
||||
value: '--image-vae-tiling'
|
||||
},
|
||||
{
|
||||
label: '--image-no-vae-tiling',
|
||||
value: '--image-no-vae-tiling'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -170,6 +170,25 @@ const ParamsSettings: React.FC<ParamsSettingsProps> = forwardRef(
|
||||
[form, handleFieldValueChange]
|
||||
);
|
||||
|
||||
const renderDescription = useCallback(
|
||||
(item: ParamsSchema) => {
|
||||
if (!item.description) {
|
||||
return null;
|
||||
}
|
||||
if (item.description.html) {
|
||||
return (
|
||||
<div
|
||||
className="m-t-5"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: intl.formatMessage({ id: item.description.text })
|
||||
}}
|
||||
></div>
|
||||
);
|
||||
}
|
||||
return intl.formatMessage({ id: item.description.text });
|
||||
},
|
||||
[intl]
|
||||
);
|
||||
const renderFields = useMemo(() => {
|
||||
if (!paramsConfig?.length) {
|
||||
return null;
|
||||
@@ -210,6 +229,7 @@ const ParamsSettings: React.FC<ParamsSettingsProps> = forwardRef(
|
||||
<Form.Item name={item.name} rules={item.rules} key={item.name}>
|
||||
<SealSelect
|
||||
{...item.attrs}
|
||||
description={renderDescription(item)}
|
||||
options={item.options}
|
||||
label={
|
||||
item.label.isLocalized
|
||||
@@ -249,7 +269,7 @@ const ParamsSettings: React.FC<ParamsSettingsProps> = forwardRef(
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}, [paramsConfig, params, intl]);
|
||||
}, [paramsConfig, params, renderDescription, intl]);
|
||||
|
||||
return (
|
||||
<Form
|
||||
|
||||
@@ -117,6 +117,11 @@ export const ImageParamsConfig: ParamsSchema[] = [
|
||||
{ label: '512x512', value: '512x512' },
|
||||
{ label: '1024x1024', value: '1024x1024' }
|
||||
],
|
||||
description: {
|
||||
text: 'playground.params.size.description',
|
||||
html: true,
|
||||
isLocalized: true
|
||||
},
|
||||
label: {
|
||||
text: 'playground.params.size',
|
||||
isLocalized: true
|
||||
|
||||
@@ -55,6 +55,7 @@ export interface ParamsSchema {
|
||||
attrs?: Record<string, any>;
|
||||
description?: {
|
||||
text: string;
|
||||
html?: boolean;
|
||||
isLocalized?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user