aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/smartdraw/SmartDrawHandler.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/smartdraw/SmartDrawHandler.tsx')
-rw-r--r--src/client/views/smartdraw/SmartDrawHandler.tsx9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/client/views/smartdraw/SmartDrawHandler.tsx b/src/client/views/smartdraw/SmartDrawHandler.tsx
index 13a93367c..5ebe2e358 100644
--- a/src/client/views/smartdraw/SmartDrawHandler.tsx
+++ b/src/client/views/smartdraw/SmartDrawHandler.tsx
@@ -25,7 +25,7 @@ import { ActiveInkArrowEnd, ActiveInkArrowStart, ActiveInkDash, ActiveInkFillCol
import './SmartDrawHandler.scss';
import { Networking } from '../../Network';
import { OpenWhere } from '../nodes/OpenWhere';
-import { FireflyDimensionsMap, FireflyImageDimensions } from './FireflyConstants';
+import { FireflyDimensionsMap, FireflyImageDimensions, FireflyImageData } from './FireflyConstants';
export interface DrawingOptions {
text: string;
@@ -267,23 +267,24 @@ export class SmartDrawHandler extends ObservableReactComponent<object> {
/**
* Calls Firefly API to create an image based on user input
*/
- createImageWithFirefly = (input: string, seed?: number, changeInPlace?: boolean) => {
+ createImageWithFirefly = (input: string, seed?: number, changeInPlace?: boolean): Promise<FireflyImageData> => {
this._lastInput.text = input;
const dims = FireflyDimensionsMap[this._imgDims];
return Networking.PostToServer('/queryFireflyImage', { prompt: input, width: dims.width, height: dims.height, seed: seed }).then(img => {
if (!changeInPlace) {
+ const seed = img.accessPaths.agnostic.client.match(/\/(\d+)upload/)[1];
const imgDoc: Doc = Docs.Create.ImageDocument(img.accessPaths.agnostic.client, {
title: input.match(/^(.*?)~~~.*$/)?.[1] || input,
nativeWidth: dims.width,
nativeHeight: dims.height,
ai: 'firefly',
- ai_firefly_seed: img.accessPaths.agnostic.client.match(/\/(\d+)upload/)[1],
+ ai_firefly_seed: seed,
ai_firefly_prompt: input,
});
DocumentViewInternal.addDocTabFunc(imgDoc, OpenWhere.addRight);
this._selectedDocs.push(imgDoc);
}
- return img.accessPaths.agnostic.client;
+ return { prompt: input, seed: seed, pathname: img.accessPaths.agnostic.client };
});
};