aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/nodes/ComparisonBox.tsx15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/client/views/nodes/ComparisonBox.tsx b/src/client/views/nodes/ComparisonBox.tsx
index 01494f217..19fccce8a 100644
--- a/src/client/views/nodes/ComparisonBox.tsx
+++ b/src/client/views/nodes/ComparisonBox.tsx
@@ -203,6 +203,16 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps>()
this.flipFlashcard();
console.log('Print Front of cards: ' + RTFCast(DocCast(this.dataDoc[this.fieldKey + '_0']).text)?.Text);
console.log('Print Back of cards: ' + RTFCast(DocCast(this.dataDoc[this.fieldKey + '_1']).text)?.Text);
+
+ //const queryText = RTFCast(DocCast(this.dataDoc[this.fieldKey + '_0']).text)?.Text;
+ // DocCast(this.dataDoc[this.fieldKey + '_1'])[DocData].text = 'hello';
+ // const mes = gptAPICall(queryText, GPTCallType.COMPLETION).trim();
+ // const res = await gptAPICall(queryText, GPTCallType.COMPLETION)
+ // console.log(res);
+ //.then(value => (DocCast(this.dataDoc[this.fieldKey + '_1']).text = value.trim()));
+ if (usepath !== 'alternate') {
+ this.askGPT();
+ }
}
})
}
@@ -218,12 +228,15 @@ export class ComparisonBox extends ViewBoxAnnotatableComponent<FieldViewProps>()
}
askGPT = async (): Promise<string | undefined> => {
+ const queryText = RTFCast(DocCast(this.dataDoc[this.fieldKey + '_1']).text)?.Text;
try {
- let res = await gptAPICall(StrCast(this.dataDoc.data), GPTCallType.COMPLETION);
+ let res = await gptAPICall(StrCast(queryText), GPTCallType.COMPLETION);
if (!res) {
console.error('GPT call failed');
return;
}
+ DocCast(this.dataDoc[this.fieldKey + '_0'])[DocData].text = res;
+ console.log(res);
} catch (err) {
console.error('GPT call failed');
}