diff options
| author | bobzel <zzzman@gmail.com> | 2025-01-10 12:38:00 -0500 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2025-01-10 12:38:00 -0500 |
| commit | c2312afe4ee969043ba3ce4cb9c275a48b0f1ee0 (patch) | |
| tree | 9aba40dc2444e03567def5d3f2a4dc7aa0458b21 /src/client/views/smartdraw | |
| parent | 2a24d77845d6c1d4f0730a9427572033c506b14c (diff) | |
fixed scrolling when ai editor is open. rearranged items in ImageBox ai editor to be more compact. added error catch handler to queryFireflyImage
Diffstat (limited to 'src/client/views/smartdraw')
| -rw-r--r-- | src/client/views/smartdraw/SmartDrawHandler.tsx | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/src/client/views/smartdraw/SmartDrawHandler.tsx b/src/client/views/smartdraw/SmartDrawHandler.tsx index 4052ea852..f635b5642 100644 --- a/src/client/views/smartdraw/SmartDrawHandler.tsx +++ b/src/client/views/smartdraw/SmartDrawHandler.tsx @@ -271,22 +271,24 @@ export class SmartDrawHandler extends ObservableReactComponent<object> { 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 => { - const seed = img.accessPaths.agnostic.client.match(/\/(\d+)upload/)[1]; - if (!changeInPlace) { - 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: seed, - ai_firefly_prompt: input, - }); - DocumentViewInternal.addDocTabFunc(imgDoc, OpenWhere.addRight); - this._selectedDocs.push(imgDoc); - } - return { prompt: input, seed, pathname: img.accessPaths.agnostic.client }; - }); + return Networking.PostToServer('/queryFireflyImage', { prompt: input, width: dims.width, height: dims.height, seed: seed }) + .then(img => { + const seed = img.accessPaths.agnostic.client.match(/\/(\d+)upload/)[1]; + if (!changeInPlace) { + 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: seed, + ai_firefly_prompt: input, + }); + DocumentViewInternal.addDocTabFunc(imgDoc, OpenWhere.addRight); + this._selectedDocs.push(imgDoc); + } + return { prompt: input, seed, pathname: img.accessPaths.agnostic.client }; + }) + .catch(e => alert('create image failed: ' + e.toString())); }; /** |
