fix: image size options
This commit is contained in:
@@ -135,8 +135,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
const getNewImageSizeOptions = useCallback((metaData: any) => {
|
const paramsConfig = useMemo(() => {
|
||||||
const { max_height, max_width } = metaData || {};
|
const { max_height, max_width } = modelMeta;
|
||||||
if (!max_height || !max_width) {
|
if (!max_height || !max_width) {
|
||||||
return ImageParamsConfig;
|
return ImageParamsConfig;
|
||||||
}
|
}
|
||||||
@@ -155,12 +155,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
value: `${max_width}x${max_height}`
|
value: `${max_width}x${max_height}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return newImageSizeOptions;
|
let result: ParamsSchema[] = ImageParamsConfig.map((item: ParamsSchema) => {
|
||||||
}, []);
|
|
||||||
|
|
||||||
const paramsConfig = useMemo(() => {
|
|
||||||
const newImageSizeOptions = getNewImageSizeOptions(modelMeta);
|
|
||||||
let result = ImageParamsConfig.map((item) => {
|
|
||||||
if (item.name === 'size') {
|
if (item.name === 'size') {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
@@ -173,7 +168,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
result = result.filter((item) => item.name !== 'size');
|
result = result.filter((item) => item.name !== 'size');
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}, [modelMeta, getNewImageSizeOptions]);
|
}, [modelMeta]);
|
||||||
|
|
||||||
const generateNumber = (min: number, max: number) => {
|
const generateNumber = (min: number, max: number) => {
|
||||||
return Math.floor(Math.random() * (max - min + 1) + min);
|
return Math.floor(Math.random() * (max - min + 1) + min);
|
||||||
|
|||||||
@@ -155,8 +155,8 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const getNewImageSizeOptions = useCallback((metaData: any) => {
|
const paramsConfig = useMemo(() => {
|
||||||
const { max_height, max_width } = metaData || {};
|
const { max_height, max_width } = modelMeta;
|
||||||
if (!max_height || !max_width) {
|
if (!max_height || !max_width) {
|
||||||
return ImageParamsConfig;
|
return ImageParamsConfig;
|
||||||
}
|
}
|
||||||
@@ -175,11 +175,6 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
value: `${max_width}x${max_height}`
|
value: `${max_width}x${max_height}`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return newImageSizeOptions;
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
const paramsConfig = useMemo(() => {
|
|
||||||
const newImageSizeOptions = getNewImageSizeOptions(modelMeta);
|
|
||||||
let result = ImageParamsConfig.map((item) => {
|
let result = ImageParamsConfig.map((item) => {
|
||||||
if (item.name === 'size') {
|
if (item.name === 'size') {
|
||||||
return {
|
return {
|
||||||
@@ -193,7 +188,7 @@ const GroundImages: React.FC<MessageProps> = forwardRef((props, ref) => {
|
|||||||
result = result.filter((item) => item.name !== 'size');
|
result = result.filter((item) => item.name !== 'size');
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}, [modelMeta, getNewImageSizeOptions]);
|
}, [modelMeta]);
|
||||||
|
|
||||||
const setImageSize = useCallback(() => {
|
const setImageSize = useCallback(() => {
|
||||||
let size: Record<string, string | number> = {
|
let size: Record<string, string | number> = {
|
||||||
|
|||||||
Reference in New Issue
Block a user