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
|
||||
),
|
||||
"mtime": os.path.getmtime(path),
|
||||
"metadata": metadata,
|
||||
"metadata": metadata.get("sd-metadata"),
|
||||
"dreamPrompt": metadata.get("Dream"),
|
||||
"width": width,
|
||||
"height": height,
|
||||
"category": category,
|
||||
@ -496,7 +497,8 @@ class InvokeAIWebServer:
|
||||
thumbnail_path
|
||||
),
|
||||
"mtime": os.path.getmtime(path),
|
||||
"metadata": metadata,
|
||||
"metadata": metadata.get("sd-metadata"),
|
||||
"dreamPrompt": metadata.get("Dream"),
|
||||
"width": width,
|
||||
"height": height,
|
||||
"category": category,
|
||||
@ -659,7 +661,8 @@ class InvokeAIWebServer:
|
||||
"url": self.get_url_from_image_path(path),
|
||||
"thumbnail": self.get_url_from_image_path(thumbnail_path),
|
||||
"mtime": os.path.getmtime(path),
|
||||
"metadata": metadata,
|
||||
"metadata": metadata.get("sd-metadata"),
|
||||
"dreamPrompt": metadata.get("Dream"),
|
||||
"width": width,
|
||||
"height": height,
|
||||
},
|
||||
@ -1090,6 +1093,7 @@ class InvokeAIWebServer:
|
||||
"thumbnail": self.get_url_from_image_path(thumbnail_path),
|
||||
"mtime": os.path.getmtime(path),
|
||||
"metadata": metadata,
|
||||
"dreamPrompt": command,
|
||||
"width": width,
|
||||
"height": height,
|
||||
"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;
|
||||
category: GalleryCategory;
|
||||
isBase64?: boolean;
|
||||
dreamPrompt?: 'string';
|
||||
};
|
||||
|
||||
// GalleryImages is an array of Image.
|
||||
|
@ -45,6 +45,7 @@ type MetadataItemProps = {
|
||||
onClick?: () => void;
|
||||
value: number | string | boolean;
|
||||
labelPosition?: string;
|
||||
withCopy?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -56,6 +57,7 @@ const MetadataItem = ({
|
||||
onClick,
|
||||
isLink,
|
||||
labelPosition,
|
||||
withCopy = false,
|
||||
}: MetadataItemProps) => {
|
||||
return (
|
||||
<Flex gap={2}>
|
||||
@ -71,6 +73,18 @@ const MetadataItem = ({
|
||||
/>
|
||||
</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'}>
|
||||
<Text fontWeight={'semibold'} whiteSpace={'pre-wrap'} pr={2}>
|
||||
{label}:
|
||||
@ -115,6 +129,8 @@ const ImageMetadataViewer = memo(
|
||||
});
|
||||
|
||||
const metadata = image?.metadata?.image || {};
|
||||
const dreamPrompt = image?.dreamPrompt;
|
||||
|
||||
const {
|
||||
type,
|
||||
postprocessing,
|
||||
@ -381,6 +397,13 @@ const ImageMetadataViewer = memo(
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
{dreamPrompt && (
|
||||
<MetadataItem
|
||||
withCopy
|
||||
label="Dream Prompt"
|
||||
value={dreamPrompt}
|
||||
/>
|
||||
)}
|
||||
<Flex gap={2} direction={'column'}>
|
||||
<Flex gap={2}>
|
||||
<Tooltip label={`Copy metadata JSON`}>
|
||||
|
Loading…
Reference in New Issue
Block a user