aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/smartdraw/StickerPalette.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-05-07 15:46:06 -0400
committerbobzel <zzzman@gmail.com>2025-05-07 15:46:06 -0400
commit4b8c4c9277cca69ea3341ca6ddf4c7f5befc78a0 (patch)
tree4695559c1d3e4cac7a8f58e0d0aaf3037a7ec14e /src/client/views/smartdraw/StickerPalette.tsx
parentd0cbb43ec3fa19f76a570f5e0038bfc72c9f37b9 (diff)
cleaned up ai metadata on generated drawings.
Diffstat (limited to 'src/client/views/smartdraw/StickerPalette.tsx')
-rw-r--r--src/client/views/smartdraw/StickerPalette.tsx12
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;