s-kostyaev / ellama

Ellama is a tool for interacting with large language models from Emacs.
GNU General Public License v3.0
348 stars 25 forks source link

Text gets deleted if command fails #93

Open asmeurer opened 3 months ago

asmeurer commented 3 months ago

If you run a command like ellama-improve-grammar on a selection, but the command fails for some reason, the paragraph is just completely deleted. For example, this happened to me because I misconfigured my OpenAI API key permissions, but I imagine it could also happen if the API service or my internet went down.

I think it would be better if ellama commands like this did not actually attempt to delete any text from the buffer until the LLM command completes. Perhaps there's an issue with race conditions here, but I would even be OK if it blocked (so long as there was some sort of progress indicator).

At the very least, though, if a command fails for some reason, it should reinsert the original text into the buffer.

s-kostyaev commented 3 months ago

Blocker for this issue https://github.com/ahyatt/llm/issues/37