feat(compose): AI writing assistant in the composer (LC-532) #506
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/LC-532-composer-ai-assist"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
First build from the Round 3 shortlist (LC-531): a composer AI writing assistant.
What it does: a sparkle button in the composer sends your current draft to the operator's LLM and returns a rewritten suggestion in five modes - rephrase, fix grammar, concise, friendly, formal. "Use this" drops it into the composer; the mode chips regenerate on the current draft; "Dismiss" clears it.
Stack fit: reuses the already-wired
llm::complete(mirrorsroutes::translate), the composer, and the[data-lc-llm]CSS gate. The button is hidden entirely unless an LLM is configured. No new DB, no new dependency - just a new endpoint + a composer affordance.Three small commits: endpoint + panel template, composer wiring (button/slot/apply-dismiss JS), tests.
Privacy (the one call-out from the brainstorm): unlike the existing AI features which act on already-posted text, this sends an unsent draft to the LLM. It is therefore explicit opt-in per click, gated on an LLM being configured, never auto-run, and the draft is length-capped before sending. The integration test asserts that with no LLM configured the endpoint 400s so the draft never leaves the device.
Verification: end-to-end HTTP test with a mock LLM (happy path returns the panel with the suggestion + chips; empty draft 400s; no-LLM 400s) + inline unit tests.
just test+just test-saas+just checkgreen.Not operator-visible (no new env/config; it rides the existing
LETS_CHAT_LLM_*).🤖 Generated with Claude Code
Adds POST /room/{id}/compose-assist: gate on an LLM being configured + room access, then rewrite the draft via llm::complete in one of five modes (rephrase / grammar / concise / friendly / formal) and return a panel with the suggestion + mode chips. Mirrors routes::translate. The draft is length-capped (4000 chars) before it is sent; empty drafts and unknown actions are handled. i18n en + es; inline unit tests cover action resolution and prompt shape. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NTRhc4n7A2uB2Y5PHV2ewL