aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/pdf/GPTPopup
diff options
context:
space:
mode:
authorsrichman333 <sarah_n_richman@brown.edu>2024-04-16 00:44:43 -0400
committersrichman333 <sarah_n_richman@brown.edu>2024-04-16 00:44:43 -0400
commit982991ca69cd7f844680949ed160e678f89050fc (patch)
treed205fb7061ce891cbd5b11bf4b809788b4abda69 /src/client/views/pdf/GPTPopup
parentc254b38690e27b32d3ac6316af9bb37d6d3e86aa (diff)
correlation from gpt
Diffstat (limited to 'src/client/views/pdf/GPTPopup')
-rw-r--r--src/client/views/pdf/GPTPopup/GPTPopup.tsx10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client/views/pdf/GPTPopup/GPTPopup.tsx b/src/client/views/pdf/GPTPopup/GPTPopup.tsx
index 29b1ca365..50835a541 100644
--- a/src/client/views/pdf/GPTPopup/GPTPopup.tsx
+++ b/src/client/views/pdf/GPTPopup/GPTPopup.tsx
@@ -15,6 +15,7 @@ import { DocUtils, Docs } from '../../../documents/Documents';
import { ObservableReactComponent } from '../../ObservableReactComponent';
import { AnchorMenu } from '../AnchorMenu';
import './GPTPopup.scss';
+import { DataVizView } from '../../nodes/DataVizBox/DataVizBox';
export enum GPTPopupMode {
SUMMARY,
@@ -121,6 +122,7 @@ export class GPTPopup extends ObservableReactComponent<GPTPopupProps> {
};
public addDoc: (doc: Doc | Doc[], sidebarKey?: string | undefined) => boolean = () => false;
+ public createFilteredDoc: (axes?: any, type?: DataVizView) => boolean = () => false;
public addToCollection: ((doc: Doc | Doc[], annotationKey?: string | undefined) => boolean) | undefined;
/**
@@ -168,7 +170,11 @@ export class GPTPopup extends ObservableReactComponent<GPTPopupProps> {
GPTPopup.Instance.setLoading(true);
try {
let res = await gptAPICall(this.dataJson, GPTCallType.DATA, this.dataChatPrompt);
- GPTPopup.Instance.setText(res || 'Something went wrong.');
+ console.log(res)
+ let json = JSON.parse(res! as string);
+ const keys = Object.keys(json)
+ console.log(json[keys[0]], json[keys[1]])
+ GPTPopup.Instance.setText(json[keys[2]] || 'Something went wrong.');
} catch (err) {
console.error(err);
}
@@ -192,6 +198,8 @@ export class GPTPopup extends ObservableReactComponent<GPTPopupProps> {
link_relationship: 'GPT Summary',
});
}
+
+ this.createFilteredDoc();
};
/**