From ad32c1606395cdc71ba50eb9b51d3a9d3b707ca0 Mon Sep 17 00:00:00 2001 From: alyssaf16 Date: Tue, 18 Jun 2024 15:23:12 -0400 Subject: working on various image flashcard ideas --- src/client/views/nodes/ComparisonBox.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/client/views/nodes/ComparisonBox.tsx') diff --git a/src/client/views/nodes/ComparisonBox.tsx b/src/client/views/nodes/ComparisonBox.tsx index 2fc297bec..3d33ff862 100644 --- a/src/client/views/nodes/ComparisonBox.tsx +++ b/src/client/views/nodes/ComparisonBox.tsx @@ -92,6 +92,7 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent() Doc.SetContainer(droppedDocuments.lastElement(), this.dataDoc); !added && e.preventDefault(); e.stopPropagation(); // prevent parent Doc from registering new position so that it snaps back into place + // this.childActive = false; return added; } return undefined; @@ -257,7 +258,7 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent() newCol['x'] = this.layoutDoc['x']; newCol['y'] = NumCast(this.layoutDoc['y']) + 50; newCol.type_collection = 'carousel'; - console.log(newCol.data); + // console.log(newCol.data); if (gpt) { this._props.DocumentView?.()._props.addDocument?.(newCol); @@ -270,13 +271,13 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent() } gptFlashcardPile = async () => { - var text = (await this.askGPT(GPTCallType.FLASHCARD)) || ''; + var text = await this.askGPT(GPTCallType.FLASHCARD); - var senArr = text.trim().split('Question: '); + var senArr = text?.split('Question: '); var collectionArr: Doc[] = []; - for (let i = 1; i < senArr.length; i++) { - const newDoc = Docs.Create.ComparisonDocument(senArr[i].trim(), { _layout_isFlashcard: true, _width: 300, _height: 300 }); - newDoc.text = senArr[i].trim(); + for (let i = 1; i < senArr?.length!; i++) { + const newDoc = Docs.Create.ComparisonDocument(senArr![i], { _layout_isFlashcard: true, _width: 300, _height: 300 }); + newDoc.text = senArr![i]; collectionArr.push(newDoc); } this.createFlashcardPile(collectionArr, true); @@ -451,13 +452,12 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent() if (callType == GPTCallType.QUIZ) this._outputValue = res; // DocCast(this.dataDoc[this.props.fieldKey + '_0'])[DocData].text = res; // this._outputValue = res; - - if (callType === GPTCallType.FLASHCARD) { + else if (callType === GPTCallType.FLASHCARD) { // console.log(res); this._loading = false; return res; } - console.log(res); + // console.log(res); } catch (err) { console.error('GPT call failed'); } -- cgit v1.2.3-70-g09d2