From 53f816699c77a178e43a314fc8f9335f5f1115f3 Mon Sep 17 00:00:00 2001 From: bobzel Date: Wed, 23 Jul 2025 13:49:59 -0400 Subject: fix for having gpt operate on docs with newlines in their descriptions. --- src/client/views/pdf/GPTPopup/GPTPopup.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/client/views/pdf/GPTPopup/GPTPopup.tsx b/src/client/views/pdf/GPTPopup/GPTPopup.tsx index 9c37428ee..b01a96c24 100644 --- a/src/client/views/pdf/GPTPopup/GPTPopup.tsx +++ b/src/client/views/pdf/GPTPopup/GPTPopup.tsx @@ -93,8 +93,12 @@ export class GPTPopup extends ObservableReactComponent { this.onGptResponse = (sortResult: string, questionType: GPTDocCommand) => this.processGptResponse(selDoc, this._textToDocMap, sortResult, questionType); this.onQuizRandom = () => this.randomlyChooseDoc(selDoc.Document, hasChildDocs()); this._documentDescriptions = Promise.all(hasChildDocs().map(doc => - Doc.getDescription(doc).then(text => this._textToDocMap.set(text.replace(/\n/g, ' ').trim(), doc) && `${DescriptionSeperator}${text}${DescriptionSeperator}`) + Doc.getDescription(doc).then(text => text.replace(/\n/g, ' ').trim()) + .then(text => this._textToDocMap.set(text, doc) && `${DescriptionSeperator}${text}${DescriptionSeperator}`) )).then(docDescriptions => docDescriptions.join()); // prettier-ignore + this._documentDescriptions.then(descs => { + console.log(descs); + }); } }, { fireImmediately: true } -- cgit v1.2.3-70-g09d2