This commit is contained in:
Enrico Ros
2024-06-14 18:41:27 -07:00
parent 1efca7dd48
commit ae24dd1e28
5 changed files with 38 additions and 29 deletions
+1
View File
@@ -49,6 +49,7 @@ export async function runImageGenerationUpdatingState(cHandler: ConversationHand
return true;
} catch (error: any) {
const drawError = `Issue: Sorry, I couldn't create an image for you.\n${error?.message || error?.toString() || 'Unknown error'}`;
cHandler.messageFragmentReplace(assistantMessageId, placeholderFragmentId, createErrorContentFragment(drawError), true);
+33 -26
View File
@@ -113,11 +113,12 @@ export function DrawCreate(props: {
// state
const [prompts, setPrompts] = React.useState<DesignerPrompt[]>([]);
// external state
const { queueState } = useProcessingQueue(props.queue);
console.log('DrawCreate', { queueState });
// handlers
// handlers
const handleStopDrawing = React.useCallback(() => {
setPrompts([]);
}, []);
@@ -171,35 +172,41 @@ export function DrawCreate(props: {
}}
>
{/* Gallery/Placeholders Grid */}
<Box sx={{
// my: 'auto',
mt: 'auto',
mx: 'auto',
border: '1px solid purple',
minHeight: '300px',
{/* Draw history (last 50) */}
// layout
display: 'grid',
gridTemplateColumns: props.isMobile
? 'repeat(auto-fit, minmax(320px, 1fr))'
: 'repeat(auto-fit, minmax(max(min(100%, 400px), 100%/5), 1fr))',
gap: { xs: 2, md: 2 },
}}>
{/*<Box sx={{*/}
{/* // my: 'auto',*/}
{/* // display: 'flex', flexDirection: 'column', alignItems: 'center',*/}
{/* border: DEBUG_LAYOUT ? '1px solid purple' : undefined,*/}
{/* minHeight: '300px',*/}
{/* {prompts.map((prompt, _index) => {*/}
{/* return (*/}
{/* <TempPromptImageGen*/}
{/* key={prompt.dpId}*/}
{/* prompt={prompt}*/}
{/* sx={{*/}
{/* border: DEBUG_LAYOUT ? '1px solid green' : undefined,*/}
{/* }}*/}
{/* />*/}
{/* );*/}
{/* // layout*/}
{/* display: 'grid',*/}
{/* gridTemplateColumns: props.isMobile*/}
{/* ? 'repeat(auto-fit, minmax(320px, 1fr))'*/}
{/* : 'repeat(auto-fit, minmax(max(min(100%, 400px), 100%/5), 1fr))',*/}
{/* gap: { xs: 2, md: 2 },*/}
{/*}}>*/}
{/* {prompts.map((prompt, _index) => {*/}
{/* return (*/}
{/* <TempPromptImageGen*/}
{/* key={prompt.dpId}*/}
{/* prompt={prompt}*/}
{/* sx={{*/}
{/* border: DEBUG_LAYOUT ? '1px solid green' : undefined,*/}
{/* }}*/}
{/* />*/}
{/* );*/}
{/* })}*/}
{/*</Box>*/}
<Box sx={{background:'red'}}>a</Box>
<Box>a</Box>
<Box>a</Box>
<Box>a</Box>
<Box>a</Box>
<Box>a</Box>
</Box>
{/* Fallback */}
<ZeroGenerations />
+1
View File
@@ -3,6 +3,7 @@ import { Box, Table } from '@mui/joy';
import { DBlobAssetType, DBlobImageAsset } from '~/modules/dblobs/dblobs.types';
import { useDBAssetsByScopeAndType } from '~/modules/dblobs/dblobs.hooks';
import { ZeroGallery } from './gallery/ZeroGallery';
+1 -1
View File
@@ -12,7 +12,7 @@ const drawCreateWorker: ItemAsyncWorker<DesignerPrompt> = async (item, _update,
item.prompt,
item._repeatCount,
'global', 'app-draw',
);
).catch(console.error);
return item;
};
+2 -2
View File
@@ -17,8 +17,8 @@ export async function requestPersistentStorage(): Promise<boolean> {
}
const isGranted = await navigator.storage.persist();
if (DEBUG_PERSISTENCE)
console.log(`Persistent storage granted: ${isGranted}`, await estimatePersistentStorageOrThrow());
if (DEBUG_PERSISTENCE || !isGranted)
console.warn('Persistent storage granted', isGranted, /*await navigator.storage.getDirectory(),*/ await estimatePersistentStorageOrThrow());
return isGranted;
}
} catch (error) {