mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fixes metadata viewer not showing metadata after refresh
Also adds Dream-style prompt to metadata
This commit is contained in:
parent
306ed44e19
commit
0cdb7bb0cd
@ -425,7 +425,8 @@ class InvokeAIWebServer:
|
|||||||
thumbnail_path
|
thumbnail_path
|
||||||
),
|
),
|
||||||
"mtime": os.path.getmtime(path),
|
"mtime": os.path.getmtime(path),
|
||||||
"metadata": metadata,
|
"metadata": metadata.get("sd-metadata"),
|
||||||
|
"dreamPrompt": metadata.get("Dream"),
|
||||||
"width": width,
|
"width": width,
|
||||||
"height": height,
|
"height": height,
|
||||||
"category": category,
|
"category": category,
|
||||||
@ -496,7 +497,8 @@ class InvokeAIWebServer:
|
|||||||
thumbnail_path
|
thumbnail_path
|
||||||
),
|
),
|
||||||
"mtime": os.path.getmtime(path),
|
"mtime": os.path.getmtime(path),
|
||||||
"metadata": metadata,
|
"metadata": metadata.get("sd-metadata"),
|
||||||
|
"dreamPrompt": metadata.get("Dream"),
|
||||||
"width": width,
|
"width": width,
|
||||||
"height": height,
|
"height": height,
|
||||||
"category": category,
|
"category": category,
|
||||||
@ -659,7 +661,8 @@ class InvokeAIWebServer:
|
|||||||
"url": self.get_url_from_image_path(path),
|
"url": self.get_url_from_image_path(path),
|
||||||
"thumbnail": self.get_url_from_image_path(thumbnail_path),
|
"thumbnail": self.get_url_from_image_path(thumbnail_path),
|
||||||
"mtime": os.path.getmtime(path),
|
"mtime": os.path.getmtime(path),
|
||||||
"metadata": metadata,
|
"metadata": metadata.get("sd-metadata"),
|
||||||
|
"dreamPrompt": metadata.get("Dream"),
|
||||||
"width": width,
|
"width": width,
|
||||||
"height": height,
|
"height": height,
|
||||||
},
|
},
|
||||||
@ -1090,6 +1093,7 @@ class InvokeAIWebServer:
|
|||||||
"thumbnail": self.get_url_from_image_path(thumbnail_path),
|
"thumbnail": self.get_url_from_image_path(thumbnail_path),
|
||||||
"mtime": os.path.getmtime(path),
|
"mtime": os.path.getmtime(path),
|
||||||
"metadata": metadata,
|
"metadata": metadata,
|
||||||
|
"dreamPrompt": command,
|
||||||
"width": width,
|
"width": width,
|
||||||
"height": height,
|
"height": height,
|
||||||
"boundingBox": original_bounding_box,
|
"boundingBox": original_bounding_box,
|
||||||
|
1
frontend/src/app/invokeai.d.ts
vendored
1
frontend/src/app/invokeai.d.ts
vendored
@ -120,6 +120,7 @@ export declare type Image = {
|
|||||||
height: number;
|
height: number;
|
||||||
category: GalleryCategory;
|
category: GalleryCategory;
|
||||||
isBase64?: boolean;
|
isBase64?: boolean;
|
||||||
|
dreamPrompt?: 'string';
|
||||||
};
|
};
|
||||||
|
|
||||||
// GalleryImages is an array of Image.
|
// GalleryImages is an array of Image.
|
||||||
|
@ -45,6 +45,7 @@ type MetadataItemProps = {
|
|||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
value: number | string | boolean;
|
value: number | string | boolean;
|
||||||
labelPosition?: string;
|
labelPosition?: string;
|
||||||
|
withCopy?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -56,6 +57,7 @@ const MetadataItem = ({
|
|||||||
onClick,
|
onClick,
|
||||||
isLink,
|
isLink,
|
||||||
labelPosition,
|
labelPosition,
|
||||||
|
withCopy = false,
|
||||||
}: MetadataItemProps) => {
|
}: MetadataItemProps) => {
|
||||||
return (
|
return (
|
||||||
<Flex gap={2}>
|
<Flex gap={2}>
|
||||||
@ -71,6 +73,18 @@ const MetadataItem = ({
|
|||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
|
{withCopy && (
|
||||||
|
<Tooltip label={`Copy ${label}`}>
|
||||||
|
<IconButton
|
||||||
|
aria-label={`Copy ${label}`}
|
||||||
|
icon={<FaCopy />}
|
||||||
|
size={'xs'}
|
||||||
|
variant={'ghost'}
|
||||||
|
fontSize={14}
|
||||||
|
onClick={() => navigator.clipboard.writeText(value.toString())}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
)}
|
||||||
<Flex direction={labelPosition ? 'column' : 'row'}>
|
<Flex direction={labelPosition ? 'column' : 'row'}>
|
||||||
<Text fontWeight={'semibold'} whiteSpace={'pre-wrap'} pr={2}>
|
<Text fontWeight={'semibold'} whiteSpace={'pre-wrap'} pr={2}>
|
||||||
{label}:
|
{label}:
|
||||||
@ -115,6 +129,8 @@ const ImageMetadataViewer = memo(
|
|||||||
});
|
});
|
||||||
|
|
||||||
const metadata = image?.metadata?.image || {};
|
const metadata = image?.metadata?.image || {};
|
||||||
|
const dreamPrompt = image?.dreamPrompt;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
type,
|
type,
|
||||||
postprocessing,
|
postprocessing,
|
||||||
@ -381,6 +397,13 @@ const ImageMetadataViewer = memo(
|
|||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
{dreamPrompt && (
|
||||||
|
<MetadataItem
|
||||||
|
withCopy
|
||||||
|
label="Dream Prompt"
|
||||||
|
value={dreamPrompt}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
<Flex gap={2} direction={'column'}>
|
<Flex gap={2} direction={'column'}>
|
||||||
<Flex gap={2}>
|
<Flex gap={2}>
|
||||||
<Tooltip label={`Copy metadata JSON`}>
|
<Tooltip label={`Copy metadata JSON`}>
|
||||||
|
Loading…
Reference in New Issue
Block a user