diff options
| author | Joanne <zehan_ding@brown.edu> | 2025-05-12 21:00:38 -0400 |
|---|---|---|
| committer | Joanne <zehan_ding@brown.edu> | 2025-05-12 21:00:38 -0400 |
| commit | 430db63077868fa54829721d6530a810aa4d4588 (patch) | |
| tree | 4b1ac30d8f5d90ba4b9d5e45414e6222d3af0e09 /src/client/views/smartdraw/StickerPalette.tsx | |
| parent | cd93c88b8fee83a99342eac4dc60f7b4373fa843 (diff) | |
| parent | 0c3f86d57225a2991920adef3a337bc13e408ac0 (diff) | |
Merge branch 'master' of https://github.com/brown-dash/Dash-Web into joanne-tutorialagent
Diffstat (limited to 'src/client/views/smartdraw/StickerPalette.tsx')
| -rw-r--r-- | src/client/views/smartdraw/StickerPalette.tsx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/client/views/smartdraw/StickerPalette.tsx b/src/client/views/smartdraw/StickerPalette.tsx index 0e234e966..6ef3d26ad 100644 --- a/src/client/views/smartdraw/StickerPalette.tsx +++ b/src/client/views/smartdraw/StickerPalette.tsx @@ -9,7 +9,7 @@ import ReactLoading from 'react-loading'; import { returnEmptyFilter, returnFalse, returnTrue } from '../../../ClientUtils'; import { emptyFunction, numberRange } from '../../../Utils'; import { Doc, DocListCast, returnEmptyDoclist } from '../../../fields/Doc'; -import { ImageCast, NumCast } from '../../../fields/Types'; +import { ImageCast, NumCast, StrCast } from '../../../fields/Types'; import { ImageField } from '../../../fields/URLField'; import { DocumentType } from '../../documents/DocumentTypes'; import { Docs } from '../../documents/Documents'; @@ -147,9 +147,9 @@ export class StickerPalette extends ObservableReactComponent<StickerPaletteProps SmartDrawHandler.Instance.AddDrawing = this.addDrawing; this._canInteract = false; Promise.all( - numberRange(3).map(i => { + numberRange(3).map(() => { return this._showRegenerate - ? SmartDrawHandler.Instance.regenerate(prevDrawings, this._opts, this._gptRes[i], this._userInput) + ? SmartDrawHandler.Instance.regenerate(prevDrawings, this._userInput) : SmartDrawHandler.Instance.drawWithGPT({ X: 0, Y: 0 }, this._userInput, this._opts.complexity || 0, this._opts.size || 0, !!this._opts.autoColor); }) ).then(() => { @@ -161,8 +161,8 @@ export class StickerPalette extends ObservableReactComponent<StickerPaletteProps }); @action - addDrawing = (drawing: Doc, opts: DrawingOptions, gptRes: string) => { - this._gptRes.push(gptRes); + addDrawing = (drawing: Doc) => { + this._gptRes.push(StrCast(drawing.$ai_drawing_data)); drawing.$freeform_fitContentsToBox = true; Doc.AddDocToList(this._props.Doc, 'data', drawing); }; @@ -176,7 +176,7 @@ export class StickerPalette extends ObservableReactComponent<StickerPaletteProps const cIndex = NumCast(this._props.Doc.carousel_index); const focusedDrawing = DocListCast(this._props.Doc.data)[cIndex]; focusedDrawing.$title = this._opts.text?.match(/^(.*?)~~~.*$/)?.[1] || this._opts.text; - focusedDrawing.$ai_drawing_input = this._opts.text; + focusedDrawing.$ai_prompt = this._opts.text; focusedDrawing.$ai_drawing_complexity = this._opts.complexity; focusedDrawing.$ai_drawing_colored = this._opts.autoColor; focusedDrawing.$ai_drawing_size = this._opts.size; |
