Inline AI Writing Assistance
Autocomplete, suggested edits, and "improve this" actions inside your editor UI — with diffs the user can accept or reject piece by piece.
The most-used AI features often don't look like AI features at all. There's no chat box, just gray ghost text that finishes your sentence, an "Improve" button that appears when you select a paragraph, or a few underlined suggestions in a draft you can accept with a click. When they work, users stop noticing them. When they don't, they're the most irritating thing on the screen: slow, wrong, and in the way of typing.
In this lesson you'll build all three patterns into Deskmate's reply editor: autocomplete that's fast and cancellable, selection actions that rewrite only what was selected, and suggested edits returned as discrete changes a user can accept or reject one at a time. The model calls are the easy part. The interesting work is latency, cancellation, and keeping every change under the user's control.
Three patterns, three different budgets
Inline assistance comes in three shapes, and each one has its own latency budget, model choice, and failure mode. Treating them as one feature is how teams end up with an autocomplete that takes four seconds or an editing pass that rewrites the whole document.
| Pattern | Triggered by | Latency budget | Output | User accepts with |
|---|---|---|---|---|
| Autocomplete (ghost text) | A pause in typing | Must arrive before the user types the next few characters | A few words to a sentence | Tab |
| Selection action ("Improve", "Shorten") | An explicit click | A couple of seconds, with a visible preview | A replacement for the selection | Accept / Discard |
| Suggested edits (review pass) | An explicit click, or on save | Several seconds is fine | A list of discrete edits | Accept or reject each |
The pattern tells you the trade-off. Autocomplete is speculative: the user didn't ask for it, most suggestions will be ignored, and a slow one is worse than none. So it gets the smallest model, the lowest effort, and short outputs. Suggested edits are requested deliberately, so they can afford a stronger model and more thinking. Selection actions sit in between.