From 88caa55967b1dbf670b156dd08efc4f559067af7 Mon Sep 17 00:00:00 2001
From: srichman333 <sarah_n_richman@brown.edu>
Date: Mon, 19 Feb 2024 16:19:05 -0500
Subject: ai (updates from sophie, then added dataviz summary)

---
 src/client/views/pdf/GPTPopup/GPTPopup.tsx | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

(limited to 'src/client/views/pdf/GPTPopup/GPTPopup.tsx')

diff --git a/src/client/views/pdf/GPTPopup/GPTPopup.tsx b/src/client/views/pdf/GPTPopup/GPTPopup.tsx
index da8a88803..6e5f48a2f 100644
--- a/src/client/views/pdf/GPTPopup/GPTPopup.tsx
+++ b/src/client/views/pdf/GPTPopup/GPTPopup.tsx
@@ -20,6 +20,7 @@ export enum GPTPopupMode {
     SUMMARY,
     EDIT,
     IMAGE,
+    DATA,
 }
 
 interface GPTPopupProps {}
@@ -118,14 +119,16 @@ export class GPTPopup extends ObservableReactComponent<GPTPopupProps> {
 
         try {
             let image_urls = await gptImageCall(this.imgDesc);
+            console.log('Image urls: ', image_urls);
             if (image_urls && image_urls[0]) {
                 const [result] = await Networking.PostToServer('/uploadRemoteImage', { sources: [image_urls[0]] });
+                console.log('Upload result: ', result);
                 const source = Utils.prepend(result.accessPaths.agnostic.client);
+                console.log('Upload source: ', source);
                 this.setImgUrls([[image_urls[0], source]]);
             }
         } catch (err) {
-            console.log(err);
-            return '';
+            console.error(err);
         }
         this.setLoading(false);
     };
@@ -241,7 +244,7 @@ export class GPTPopup extends ObservableReactComponent<GPTPopupProps> {
     summaryBox = () => (
         <>
             <div>
-                {this.heading('SUMMARY')}
+                {this.mode==GPTPopupMode.SUMMARY? this.heading('SUMMARY'): this.heading("ANALYSIS")}
                 <div className="content-wrapper">
                     {!this.loading &&
                         (!this.done ? (
@@ -308,7 +311,7 @@ export class GPTPopup extends ObservableReactComponent<GPTPopupProps> {
     render() {
         return (
             <div className="summary-box" style={{ display: this.visible ? 'flex' : 'none' }}>
-                {this.mode === GPTPopupMode.SUMMARY ? this.summaryBox() : this.mode === GPTPopupMode.IMAGE ? this.imageBox() : <></>}
+                {(this.mode === GPTPopupMode.SUMMARY || this.mode === GPTPopupMode.DATA)? this.summaryBox() : this.mode === GPTPopupMode.IMAGE ? this.imageBox() : <></>}
             </div>
         );
     }
-- 
cgit v1.2.3-70-g09d2

