diff options
| author | bobzel <zzzman@gmail.com> | 2025-02-13 10:19:35 -0500 |
|---|---|---|
| committer | bobzel <zzzman@gmail.com> | 2025-02-13 10:19:35 -0500 |
| commit | 8ec3055971ed3d79289e90c1fc2d0db5df131fe5 (patch) | |
| tree | a73089d6f75855bdd5cadc2129658032b8f87431 /src/client/views/pdf/AnchorMenu.tsx | |
| parent | fed9d4964c3d7074f9e78d873e2d5b08dcac6c13 (diff) | |
trying to cleanup GPTpopup
Diffstat (limited to 'src/client/views/pdf/AnchorMenu.tsx')
| -rw-r--r-- | src/client/views/pdf/AnchorMenu.tsx | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/client/views/pdf/AnchorMenu.tsx b/src/client/views/pdf/AnchorMenu.tsx index 11f2f7988..18da01890 100644 --- a/src/client/views/pdf/AnchorMenu.tsx +++ b/src/client/views/pdf/AnchorMenu.tsx @@ -98,18 +98,14 @@ export class AnchorMenu extends AntimodeMenu<AntimodeMenuProps> { * Invokes the API with the selected text and stores it in the summarized text. * @param e pointer down event */ - gptSummarize = async () => { + gptSummarize = () => { GPTPopup.Instance.setVisible(true); GPTPopup.Instance.setMode(GPTPopupMode.SUMMARY); GPTPopup.Instance.setLoading(true); - - try { - const res = await gptAPICall(this._selectedText, GPTCallType.SUMMARY); - GPTPopup.Instance.setText(res || 'Something went wrong.'); - } catch (err) { - console.error(err); - } - GPTPopup.Instance.setLoading(false); + gptAPICall(this._selectedText, GPTCallType.SUMMARY) + .then(res => GPTPopup.Instance.setText(res || 'Something went wrong.')) + .catch(err => console.error(err)) + .finally(() => GPTPopup.Instance.setLoading(false)); }; /* |
