diff options
| author | eleanor-park <eleanor_park@brown.edu> | 2025-01-05 23:47:18 -0500 |
|---|---|---|
| committer | eleanor-park <eleanor_park@brown.edu> | 2025-01-05 23:47:18 -0500 |
| commit | 1d62d867621b293c41ff8488ca5a3bd6010723d5 (patch) | |
| tree | 0abc9d9ae2869775cfcc294838c93577fbc0fef9 /src/client/views/smartdraw/StickerPalette.tsx | |
| parent | 6e7cb570f9bad527cd4772bb5c715dd588fb77df (diff) | |
added AI image editor
Diffstat (limited to 'src/client/views/smartdraw/StickerPalette.tsx')
| -rw-r--r-- | src/client/views/smartdraw/StickerPalette.tsx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/client/views/smartdraw/StickerPalette.tsx b/src/client/views/smartdraw/StickerPalette.tsx index 352a02e32..d23763eb9 100644 --- a/src/client/views/smartdraw/StickerPalette.tsx +++ b/src/client/views/smartdraw/StickerPalette.tsx @@ -142,19 +142,20 @@ export class StickerPalette extends ObservableReactComponent<StickerPaletteProps } /** - * Calls the draw with GPT functions in SmartDrawHandler to allow users to generate drawings straight from + * Calls the draw with AI functions in SmartDrawHandler to allow users to generate drawings straight from * the sticker palette. */ @undoBatch generateDrawings = action(async () => { this._isLoading = true; + const prevDrawings = DocListCast(this._props.Document[DocData].data); this._props.Document[DocData].data = undefined; SmartDrawHandler.Instance.AddDrawing = this.addDrawing; this._canInteract = false; await Promise.all( Array.from({ length: 3 }).map((_, i) => { return this._showRegenerate - ? SmartDrawHandler.Instance.regenerate(this._opts, this._gptRes[i], this._userInput) + ? SmartDrawHandler.Instance.regenerate(prevDrawings, this._opts, this._gptRes[i], this._userInput) : SmartDrawHandler.Instance.drawWithGPT({ X: 0, Y: 0 }, this._userInput, this._opts.complexity, this._opts.size, this._opts.autoColor); }) ); @@ -181,12 +182,12 @@ export class StickerPalette extends ObservableReactComponent<StickerPaletteProps const focusedDrawing = DocListCast(this._props.Document.data)[cIndex]; const docData = focusedDrawing[DocData]; docData.title = this._opts.text.match(/^(.*?)~~~.*$/)?.[1] || this._opts.text; - docData.drawingInput = this._opts.text; - docData.drawingComplexity = this._opts.complexity; - docData.drawingColored = this._opts.autoColor; - docData.drawingSize = this._opts.size; - docData.drawingData = this._gptRes[cIndex]; - docData.ai_generated = true; + docData.ai_drawing_input = this._opts.text; + docData.ai_drawing_complexity = this._opts.complexity; + docData.ai_drawing_colored = this._opts.autoColor; + docData.ai_drawing_size = this._opts.size; + docData.ai_drawing_data = this._gptRes[cIndex]; + docData.ai = 'gpt'; focusedDrawing.width = this._opts.size; docData.x = this._opts.x; docData.y = this._opts.y; |
