ChatGPT: Modify Selection: Appendix GPT Answer

Hello,
I often use GPT and find this action very useful, but I have a question.

It’s very convenient to ask GPT for a request on the selected text and have it returned by GPT, but the fact that the original selected text is replaced can be convenient at times and inconvenient at others.

If I were to rewrite this script, where would I need to touch to make it so that “the answer result is appended after the original selected text”? :upside_down_face:

Untested, but I think changing the following…

editor.setSelectedText(answer)

… to …

answer  = editor.getSelectedText() +"\n\n" + answer
editor.setSelectedText(answer)

… will do it.

2 Likes

It works, thank you!!!

I don’t know what I’m doing wrong, but this Action doesn’t work at all for me. All the other ChatGPT actions work, but this one doesn’t. I get the red “action failed” message. Is this action still working for everyone? @agiletortoise Would it be possible to post a version that has been tested?

What does the action log say when you run the action? That should contain information about why the action failed.

It’s now working. I had purchased some tokens but they were taking some time to kick in. It needed half an hour or so. All is working now. Thanks.