aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2025-02-28 15:40:51 -0500
committerbobzel <zzzman@gmail.com>2025-02-28 15:40:51 -0500
commit0e7ae057264445ece675e4b5d2380893ea124112 (patch)
tree2ed07331abb4a7be9e131cfe1d86ede2b9a5dee5 /src/client/views/pdf
parent264a11754d31458f823812a85f4ee7b6d8f0596b (diff)
fixed gptpopup disappearing in overlayView. added creation of images based on selection image in gptpopup.
Diffstat (limited to 'src/client/views/pdf')
-rw-r--r--src/client/views/pdf/GPTPopup/GPTPopup.tsx21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/client/views/pdf/GPTPopup/GPTPopup.tsx b/src/client/views/pdf/GPTPopup/GPTPopup.tsx
index 96c7f37a3..79f5121ed 100644
--- a/src/client/views/pdf/GPTPopup/GPTPopup.tsx
+++ b/src/client/views/pdf/GPTPopup/GPTPopup.tsx
@@ -28,6 +28,8 @@ import './GPTPopup.scss';
import { FireflyImageDimensions } from '../../smartdraw/FireflyConstants';
import { Upload } from '../../../../server/SharedMediaTypes';
import { OpenWhere } from '../../nodes/OpenWhere';
+import { DrawingFillHandler } from '../../smartdraw/DrawingFillHandler';
+import { ImageField } from '../../../../fields/URLField';
export enum GPTPopupMode {
SUMMARY, // summary of seleted document text
@@ -204,13 +206,18 @@ export class GPTPopup extends ObservableReactComponent<object> {
)) // prettier-ignore
generateFireflyImage = (imgDesc: string) => {
- // if (this._fireflyRefStrength) {
- // DrawingFillHandler.drawingToImage(this.props.Document, this._fireflyRefStrength, this._regenInput || StrCast(this.Document.title), this.Document)?.then(
- // action(() => {
- // this._regenerateLoading = false;
- // })
- // );
- // } else∂
+ const selView = DocumentView.Selected().lastElement();
+ const selDoc = selView?.Document;
+ if (selDoc && (selView._props.renderDepth > 1 || selDoc[Doc.LayoutFieldKey(selDoc)] instanceof ImageField)) {
+ const oldPrompt = StrCast(selDoc.ai_firefly_prompt, StrCast(selDoc.title));
+ const newPrompt = oldPrompt ? `${oldPrompt} ~~~ ${imgDesc}` : imgDesc;
+ return DrawingFillHandler.drawingToImage(selDoc, 100, newPrompt, selDoc)
+ .then(action(() => (this._userPrompt = '')))
+ .catch(e => {
+ alert(e);
+ return undefined;
+ });
+ }
return SmartDrawHandler.CreateWithFirefly(imgDesc, FireflyImageDimensions.Square, 0)
.then(
action(doc => {