diff options
| author | Sophie Zhang <sophie_zhang@brown.edu> | 2023-04-13 01:50:41 -0400 |
|---|---|---|
| committer | Sophie Zhang <sophie_zhang@brown.edu> | 2023-04-13 01:50:41 -0400 |
| commit | cd30c14116bbbab16c21a7ecc31090d2b4bf413f (patch) | |
| tree | 3373db680316825e3315b131e74028436bc742d7 /src/client/views/pdf/AnchorMenu.tsx | |
| parent | 65781ccf9a3f19578cf4a51bca65b35c05c0795b (diff) | |
cleaning
Diffstat (limited to 'src/client/views/pdf/AnchorMenu.tsx')
| -rw-r--r-- | src/client/views/pdf/AnchorMenu.tsx | 13 |
1 files changed, 7 insertions, 6 deletions
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> |
