From e7f17e49612ca514fa5b3919f2c7459dcad448f7 Mon Sep 17 00:00:00 2001 From: sharkiecodes Date: Thu, 5 Jun 2025 22:51:53 -0400 Subject: reverting away from multi-gen --- .../collections/collectionFreeForm/MarqueeView.tsx | 118 +-------------------- 1 file changed, 1 insertion(+), 117 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx index 05d4cd81d..b8d203cf6 100644 --- a/src/client/views/collections/collectionFreeForm/MarqueeView.tsx +++ b/src/client/views/collections/collectionFreeForm/MarqueeView.tsx @@ -22,7 +22,6 @@ import { ObservableReactComponent } from '../../ObservableReactComponent'; import { MarqueeViewBounds } from '../../PinFuncs'; import { PreviewCursor } from '../../PreviewCursor'; import { DocumentView } from '../../nodes/DocumentView'; -import { OverlayDisposer } from '../../OverlayView'; import { OpenWhere } from '../../nodes/OpenWhere'; import { pasteImageBitmap } from '../../nodes/WebBoxRenderer'; import { FormattedTextBox } from '../../nodes/formattedText/FormattedTextBox'; @@ -91,8 +90,6 @@ export class MarqueeView extends ObservableReactComponent { - if (i !== idx) { - this.props.removeDocument?.(doc); - } - }); - - // 3) Clear state and close the popup - this.aiChoices = []; - this.pickerVisible = false; - } - - /** Called when user clicks outside or the “×” in ScrapbookPicker */ - @action - cancelScrapbookChoice() { - // 1) Remove all temp scrapbooks - this.aiChoices.forEach((doc) => { - this.props.removeDocument?.(doc); - }); - - // 2) Clear array and hide popup - this.aiChoices = []; - this.pickerVisible = false; - } - @action - generateAiScrapbooks = async () => { - const n = 3; // Number of AI scrapbook presets - const descriptors = this.getAiPresetsDescriptors(); - if (descriptors.length === 0) { - alert('No documents selected to generate a scrapbook from!'); - return; - } - - // 1) Start N parallel requests for JSON configs - const calls: Promise[] = []; - for (let i = 0; i < n; i++) { - calls.push(requestAiGeneratedPreset(descriptors)); - } - - // 2) Optionally show a “spinner” overlay in‐line here if you like… - // (But for brevity, let’s omit that.) - - try { - const allConfigsArrays = await Promise.all(calls); - - runInAction(() => { - // 3) For each returned config array, build placeholders and create _hidden_ Scrapbook doc - this.aiChoices = allConfigsArrays.map((cfgArr, i) => { - const placeholders = buildPlaceholdersFromConfigs(cfgArr); - // Off‐screen ScrapbookDocument: - const tempSb: Doc = Docs.Create.ScrapbookDocument(placeholders, { - title: `AI Preset (temp ${i + 1})`, - x: -10000, // far off screen - y: -10000, - _width: 600, - _height: 600, - backgroundColor: 'transparent', - _layout_showFlash: false, // keep it hidden until chosen - }); - this.props.addDocument?.(tempSb); - tempSb.$tags_chat = new List(['@ai_preset']); - return tempSb; - }); - - // 4) Compute where to show the popup in screen coords - const bounds = this.Bounds; - const screenTopLeft = this._props - .getContainerTransform() - .transformPoint(bounds.left, bounds.top); - this.pickerX = screenTopLeft[0] + 20; - this.pickerY = screenTopLeft[1] + 20; - this.pickerVisible = true; - }); - } catch (err) { - console.error('Error generating AI scrapbooks:', err); - alert('Failed to generate presets. Please try again.'); - } - }; @action @@ -914,25 +817,6 @@ export class MarqueeView extends ObservableReactComponent - {this.pickerVisible && ( -
- this.onScrapbookChoice(i)} - onCancel={() => this.cancelScrapbookChoice()} - /> -
-)} ); -- cgit v1.2.3-70-g09d2