1
0
Fork 0

fix(gui): handle responses with 0 images correctly

This commit is contained in:
Sean Sube 2024-04-16 19:10:26 -05:00
parent 8202e92870
commit 9e3d84d922
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 11 additions and 1 deletions

View File

@ -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);