JohannesBuchner / thunderbird-ai-grammar-mailextension

Corrects grammar mistakes in your draft email, powered by AI.
Apache License 2.0
6 stars 3 forks source link

Idea: diff the input and output text and show individual changes (similar to spellcheck) #6

Closed Bender250 closed 3 hours ago

Bender250 commented 3 hours ago

Hi,

I love the idea of this extension! However, I am not trusting the LLM to make direct changes to my email. I have the following proposal, but I lack the experience with Thunderbird extension development to judge its feasibility.

It would be great to see what changes the LLM suggested using underscored text (like with spellcheck) for only the text that changed. Something like this in Gmail:

image

How I imagine the flow:

  1. Prompt to the LLM exactly as it is now.
  2. Running some diff library on the input and output text to detect the changed parts of the text.
  3. Iterating through the changes, and for each of them, underscore the text (here I hope that Thunderbird addons have the API), ideally using other color than spellcheck (blue would be great). When user right clicks it, it shows the text by the LLM. Bonus points for productivy if the context button is shown already by placing cursor on it and by tab one would accept the change.

I think it would also resolve the issues regarding HTML content. The LLM input can be cut to plaintext only. Formatting is embedded in the input text, and LLM does not work with it at all.

I am sorry if my thinking is naive and in practice it is super complex.

JohannesBuchner commented 3 hours ago

That's how it works already:

  1. The pop-up shows a line-by-line diff so you can check.
  2. The text is changed, but you can undo with Ctrl-Z.
  3. Only plain-text is handled, both input to and output from the LLM is forced to be interpreted as text, and cannot be misinterpreted as HTML.