Natural-language scheme editing #22
Labels
No labels
area/ai
area/backend
area/frontend
area/infra
area/scheduler
area/wled
good-first-issue
priority/high
priority/low
priority/medium
type/bug
type/chore
type/ci-cd
type/docs
type/feature
type/qa
v1.0.0
v1.1.0
v1.2.0
v2.0.0
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/Iris-WLED#22
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Goal
Let users refine a scheme with plain-language instructions — "make it warmer and slower," "more Halloween, less pastel," "add a second accent color" — and get back a validated candidate scheme.
Why it's valuable
Iris already has the
SuggestionProviderabstraction with Ollama/Anthropic/OpenAI-compatible providers, a prompt builder, and Pydantic response validation. Natural-language editing is a high-delight, low-cost extension of that existing pipeline rather than net-new infrastructure.Sketch
POST /schemes/{id}/refine { instruction }that feeds the current scheme JSON + the instruction to the provider, reusing the existing validator + retry + fallback.AI_DAILY_LIMIT).Acceptance criteria
Proposed enhancement (brainstorm follow-up); builds on the M7 AI pipeline.
Landed in #130 (squash-merged to
main). All four acceptance criteria met.The design question was what happens on failure, and it splits refinement from generation cleanly.
Generation falls back to a built-in template when the model fails, which is right — it has nothing to lose, and a template beats no scheme. Refinement starts from the user's own work, so the same fallback would replace what they were editing with a generic template: losing work rather than declining to change it. So
RefinementFailedErroris a distinct exception surfacing as a 502 whose message says the scheme is unchanged, and it is.It proposes; it never writes. The endpoint returns a before and an after; accepting one loads it into the editor's own controls, and the user saves with the ordinary Save. That keeps an AI edit on exactly the path a manual edit takes — promotion to
source: user(#99), staleness cleared, audit entry. Persisting directly would have let an AI edit of an approved scheme reach the lights with nobody seeing it. It's also why refining an approved scheme is allowed at all, where generation refuses to touch one.Smaller things worth recording:
onis likewise carried forward rather than defaulted to true, which would switch a deliberately-off segment back on.Verified: 27 new provider-mocked tests,
ruff/mypyclean, 749 backend tests, frontendtsc/eslintclean, CI green.