aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/smartdraw/DrawingFillHandler.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-01-17 11:17:15 -0500
committerbobzel <zzzman@gmail.com>2025-01-17 11:17:15 -0500
commit156a2040cc51397c3656615f9133279dac900c82 (patch)
tree81fb2cf9c2c8c04cbe4b89a40d8e171103c5079c /src/client/views/smartdraw/DrawingFillHandler.tsx
parentfdc8741187489963353938072f05051b8986c400 (diff)
changed to generating 4 images for each firefly request.
Diffstat (limited to 'src/client/views/smartdraw/DrawingFillHandler.tsx')
-rw-r--r--src/client/views/smartdraw/DrawingFillHandler.tsx28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/client/views/smartdraw/DrawingFillHandler.tsx b/src/client/views/smartdraw/DrawingFillHandler.tsx
index 16ac2b79e..d0a840883 100644
--- a/src/client/views/smartdraw/DrawingFillHandler.tsx
+++ b/src/client/views/smartdraw/DrawingFillHandler.tsx
@@ -1,7 +1,7 @@
import { imageUrlToBase64 } from '../../../ClientUtils';
import { Doc, StrListCast } from '../../../fields/Doc';
import { DocData } from '../../../fields/DocSymbols';
-import { DocCast, ImageCast, NumCast } from '../../../fields/Types';
+import { DocCast, ImageCast } from '../../../fields/Types';
import { ImageField } from '../../../fields/URLField';
import { Upload } from '../../../server/SharedMediaTypes';
import { gptDescribeImage } from '../../apis/gpt/GPT';
@@ -48,20 +48,22 @@ export class DrawingFillHandler {
.then(gptDescribeImage)
.then((prompt, newPrompt = user_prompt || prompt) =>
Networking.PostToServer('/queryFireflyImageFromStructure', { prompt: `${newPrompt}`, width: dims.width, height: dims.height, structure: structureUrl, strength, presets: styles, styleUrl })
- .then((info: Upload.ImageInformation) => {
+ .then((infos: Upload.ImageInformation[]) => {
const genratedDocs = DocCast(drawing.ai_firefly_generatedDocs) ?? Docs.Create.MasonryDocument([], { _width: 400, _height: 400 });
drawing[DocData].ai_firefly_generatedDocs = genratedDocs;
- Doc.AddDocToList(
- genratedDocs,
- undefined,
- Docs.Create.ImageDocument(info.accessPaths.agnostic.client, {
- ai: 'firefly',
- title: newPrompt,
- ai_firefly_prompt: newPrompt,
- _width: 500,
- data_nativeWidth: info.nativeWidth,
- data_nativeHeight: info.nativeHeight,
- })
+ infos.map(info =>
+ Doc.AddDocToList(
+ genratedDocs,
+ undefined,
+ Docs.Create.ImageDocument(info.accessPaths.agnostic.client, {
+ ai: 'firefly',
+ title: newPrompt,
+ ai_firefly_prompt: newPrompt,
+ _width: 500,
+ data_nativeWidth: info.nativeWidth,
+ data_nativeHeight: info.nativeHeight,
+ })
+ )
);
if (!DocumentView.getFirstDocumentView(genratedDocs)) DocumentViewInternal.addDocTabFunc(genratedDocs, OpenWhere.addRight);
})