diff options
author | alyssaf16 <alyssa_feinberg@brown.edu> | 2024-04-17 16:25:51 -0400 |
---|---|---|
committer | alyssaf16 <alyssa_feinberg@brown.edu> | 2024-04-17 16:25:51 -0400 |
commit | 3fb9eada221670022aa575c72fb89103638c3cbd (patch) | |
tree | 7a05f33aa0d0acf2e3c6cc11a920310282fa368d /src/client/views/nodes/ComparisonBox.tsx | |
parent | 02ce102a6d53421d0c84faa21f34d0560450edf5 (diff) |
flip
Diffstat (limited to 'src/client/views/nodes/ComparisonBox.tsx')
-rw-r--r-- | src/client/views/nodes/ComparisonBox.tsx | 15 |
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'); } |