fix(gui): handle responses with 0 images correctly
This commit is contained in:
parent
8202e92870
commit
9e3d84d922
|
@ -27,7 +27,7 @@ export function GridItem(props: { xs: number; children: React.ReactNode }) {
|
|||
|
||||
export function ImageCard(props: ImageCardProps) {
|
||||
const { image } = props;
|
||||
const { metadata, outputs, thumbnails } = image;
|
||||
const { metadata, outputs } = image;
|
||||
|
||||
const [_hash, setHash] = useHash();
|
||||
const [blendAnchor, setBlendAnchor] = useState<Maybe<HTMLElement>>();
|
||||
|
@ -111,6 +111,16 @@ export function ImageCard(props: ImageCardProps) {
|
|||
const thumbnailURL = useMemo(() => client.thumbnailURL(image, index), [image, index]);
|
||||
const previewURL = thumbnailURL ?? outputURL;
|
||||
|
||||
if (metadata.length === 0) {
|
||||
return <Card sx={{ maxWidth: config.params.width.default }} elevation={2}>
|
||||
<CardContent>
|
||||
<Box textAlign='center'>
|
||||
<Typography>{t('error.emptyResult')}</Typography>
|
||||
</Box>
|
||||
</CardContent>
|
||||
</Card>;
|
||||
}
|
||||
|
||||
const model = getLabel('model', metadata[index].models[0].name);
|
||||
const scheduler = getLabel('scheduler', metadata[index].params.scheduler);
|
||||
|
||||
|
|
Loading…
Reference in New Issue