From cd30c14116bbbab16c21a7ecc31090d2b4bf413f Mon Sep 17 00:00:00 2001
From: Sophie Zhang <sophie_zhang@brown.edu>
Date: Thu, 13 Apr 2023 01:50:41 -0400
Subject: cleaning

---
 src/client/views/pdf/AnchorMenu.tsx | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

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

diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx
index c38a83238..620750f36 100644
--- a/src/client/views/pdf/AnchorMenu.tsx
+++ b/src/client/views/pdf/AnchorMenu.tsx
@@ -48,7 +48,7 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
 
     // GPT additions
     @observable private GPTpopupText: string = '';
-    @observable private loadingSummary: boolean = false;
+    @observable private loadingGPT: boolean = false;
     @observable private showGPTPopup: boolean = false;
     @observable private GPTMode: GPTPopupMode = GPTPopupMode.SUMMARY;
     @observable private selectedText: string = '';
@@ -73,7 +73,7 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
 
     @action
     setLoading = (loading: boolean) => {
-        this.loadingSummary = loading;
+        this.loadingGPT = loading;
     };
 
     @action
@@ -203,9 +203,10 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
 
         try {
             let res = await gptAPICall(selectedText, GPTCallType.EDIT);
-            // let res = await this.mockGPTCall();
+             // let res = await this.mockGPTCall();
+            if (!res) return;
             res = res.trim();
-            const resultText = fullText.slice(0, sel.from - 1) + res + fullText.slice(sel.to);
+            const resultText = fullText.slice(0, sel.from - 1) + res + fullText.slice(sel.to - 1);
 
             if (res) {
                 this.setGPTPopupText(resultText);
@@ -368,7 +369,7 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
                         visible={this.showGPTPopup}
                         text={this.GPTpopupText}
                         highlightRange={this.highlightRange}
-                        loading={this.loadingSummary}
+                        loading={this.loadingGPT}
                         callSummaryApi={this.gptSummarize}
                         callEditApi={this.gptEdit}
                         replaceText={this.replaceText}
@@ -382,7 +383,7 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> {
                         </Tooltip>
                     )}
                     {this.canEdit() && (
-                        <Tooltip key="gpttextedit" title={<div className="dash-tooltip">Edit text with AI</div>}>
+                        <Tooltip key="gpttextedit" title={<div className="dash-tooltip">AI edit suggestions</div>}>
                             <button className="antimodeMenu-button annotate" onPointerDown={this.gptEdit} style={{ cursor: 'grab' }}>
                                 <FontAwesomeIcon icon="pencil-alt" size="lg" />
                             </button>
-- 
cgit v1.2.3-70-g09d2

