From 45a9f5789fa6eaacca9a39cb96cc2a8e3ebe649c Mon Sep 17 00:00:00 2001
From: bobzel <zzzman@gmail.com>
Date: Fri, 14 Mar 2025 12:20:41 -0400
Subject: simplified anchorMenu to just have an AskAI button .. then updated
 GPtPopup's summaryBox to have a flashcard option.

---
 src/client/views/pdf/PDFViewer.tsx | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)

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

diff --git a/src/client/views/pdf/PDFViewer.tsx b/src/client/views/pdf/PDFViewer.tsx
index a50526223..83b3dffe5 100644
--- a/src/client/views/pdf/PDFViewer.tsx
+++ b/src/client/views/pdf/PDFViewer.tsx
@@ -28,7 +28,6 @@ import { AnchorMenu } from './AnchorMenu';
 import { Annotation } from './Annotation';
 import { GPTPopup } from './GPTPopup/GPTPopup';
 import './PDFViewer.scss';
-import { GPTCallType, gptAPICall } from '../../apis/gpt/GPT';
 import ReactLoading from 'react-loading';
 import { Transform } from '../../util/Transform';
 
@@ -392,23 +391,6 @@ export class PDFViewer extends ObservableReactComponent<IViewerProps> {
         }
     };
 
-    /**
-     * Create a flashcard pile based on the selected text of a pdf.
-     */
-    gptPDFFlashcards = async () => {
-        const queryText = this._selectionText;
-        runInAction(() => (this._loading = true));
-        try {
-            const res = await gptAPICall(queryText, GPTCallType.FLASHCARD);
-
-            AnchorMenu.Instance.transferToFlashcard(res || 'Something went wrong', NumCast(this._props.layoutDoc['x']), NumCast(this._props.layoutDoc['y']));
-            this._selectionText = '';
-        } catch (err) {
-            console.error(err);
-        }
-        runInAction(() => (this._loading = false));
-    };
-
     @action
     finishMarquee = (/* x?: number, y?: number */) => {
         AnchorMenu.Instance.makeLabels = unimplementedFunction;
@@ -430,7 +412,7 @@ export class PDFViewer extends ObservableReactComponent<IViewerProps> {
 
         if (sel) {
             AnchorMenu.Instance.setSelectedText(sel.toString());
-            AnchorMenu.Instance.setLocation(NumCast(this._props.layoutDoc['x']), NumCast(this._props.layoutDoc['y']));
+            AnchorMenu.Instance.setLocation(NumCast(this._props.layoutDoc.x), NumCast(this._props.layoutDoc.y));
         }
 
         if (sel?.type === 'Range') {
@@ -442,7 +424,6 @@ export class PDFViewer extends ObservableReactComponent<IViewerProps> {
         GPTPopup.Instance.addDoc = this._props.sidebarAddDoc;
         // allows for creating collection
         AnchorMenu.Instance.addToCollection = this._props.DocumentView?.()._props.addDocument;
-        AnchorMenu.Instance.gptFlashcards = this.gptPDFFlashcards;
         AnchorMenu.Instance.makeLabels = unimplementedFunction;
         AnchorMenu.Instance.AddDrawingAnnotation = this.addDrawingAnnotation;
     };
-- 
cgit v1.2.3-70-g09d2

