fix: do not edit a image in loading

This commit is contained in:
jialin
2025-01-13 19:25:30 +08:00
parent 9974fa831c
commit bf461f59de
3 changed files with 22 additions and 8 deletions
@@ -135,10 +135,10 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
};
});
const paramsConfig = useMemo(() => {
const { max_height, max_width } = modelMeta;
const getNewImageSizeOptions = useCallback((metaData: any) => {
const { max_height, max_width } = metaData || {};
if (!max_height || !max_width) {
return ImageParamsConfig;
return imageSizeOptions;
}
const newImageSizeOptions = imageSizeOptions.filter((item) => {
return item.width <= max_width && item.height <= max_height;
@@ -155,6 +155,11 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
value: `${max_width}x${max_height}`
});
}
return newImageSizeOptions;
}, []);
const paramsConfig = useMemo(() => {
const newImageSizeOptions = getNewImageSizeOptions(modelMeta);
let result: ParamsSchema[] = ImageParamsConfig.map((item: ParamsSchema) => {
if (item.name === 'size') {
return {