From 6c011f502118e5246aabd29a30494c669d917fb1 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 11 Jun 2025 12:15:39 -0400 Subject: don't autoTag text docs until they're dropped onto a scrapbook. don't re-tag a text box that has not changed. --- .../views/nodes/formattedText/FormattedTextBox.tsx | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/client/views/nodes/formattedText') diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index 1768eb08d..d700ce9f8 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -310,15 +310,17 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent { const rawText = RTFCast(this.Document[this.fieldKey])?.Text ?? StrCast(this.Document[this.fieldKey]); - const callType = rawText.includes('[placeholder]') ? GPTCallType.CLASSIFYTEXTMINIMAL : GPTCallType.CLASSIFYTEXTFULL; - - gptAPICall(rawText, callType).then( - action(desc => { - // Split GPT response into tokens and push individually & clear existing tags - this.Document.$tags_chat = new List(desc.trim().split(/\s+/)); - this.Document._layout_showTags = true; - }) - ); + if (rawText && !this.Document.$tags_chat) { + const callType = rawText.includes('[placeholder]') ? GPTCallType.CLASSIFYTEXTMINIMAL : GPTCallType.CLASSIFYTEXTFULL; + + gptAPICall(rawText, callType).then( + action(desc => { + // Split GPT response into tokens and push individually & clear existing tags + this.Document.$tags_chat = new List(desc.trim().split(/\s+/)); + this.Document._layout_showTags = true; + }) + ); + } }; leafText = (node: Node) => { @@ -382,6 +384,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent ({ title: this.Document.title, sel: this._props.isSelected() }), this.autoTag, { fireImmediately: true }); - if (!this._props.dontRegisterView) { this._disposers.record = reaction( () => this.recordingDictation, -- cgit v1.2.3-70-g09d2