I used scenes with the « Ask the AI » action, and later realized that some of them resulted in the creation of a scene. But since I don’t know how they were named and I have several hundred scenes, it’s hard to find them to ‹ clean up ›.
It would be helpful to be able to filter scenes created by the AI. Either with a dedicated button, or by ensuring that a « created by AI » label is systematically applied to this type of scene.
Ideally, this filtering should work even on scenes created recently, and not just on future ones…
For the new ones, it’s easy. For the old ones, I think there’s no technically possible way.
Hi everyone!
This topic is now in development .
A PR has been opened to automatically tag scenes created by AI and fix the tag filter:
master ← cicoub13:claude/filter-ai-generated-scenes-pcgaoc
ouvert 12:56PM - 07 Sep 26 UTC
### Description
Scenes created by the AI through the `scene.create` tool — re… achable from the "Ask AI" scene action, the AI chat and external MCP clients — were indistinguishable from hand-made ones. With hundreds of scenes there is no way to find them back to clean them up, since you don't know how the AI named them.
Every scene created that way now automatically carries the `AI` tag. The existing scene card badge and the "Filter by tags" dropdown already handle tags, so **no front-end change is needed**: the `AI` entry shows up in the filter as soon as the first AI-created scene exists.
Tags supplied by the model are kept, deduplicated case-insensitively (`t_tag_scene` has a composite primary key `(scene_id, name)`, so a duplicate name would fail the insert), and the AI tag is always stored with its canonical casing since the filter matches on an exact name.
**The tag filter had to be fixed first.** `scene.get` matched tag names with a substring `LIKE '%tag%'`, then grouped the matched rows by the tag name actually found and intersected the groups. With a short tag like `AI`, `%AI%` also matches `Maison`, `Salaire`, … and those unrelated groups were then intersected together, so the filter returned nothing. The front only ever sends exact tag names picked from the dropdown (`SceneTagFilter.jsx`), so the lookup now matches on the exact name. Requested tags that no scene carries also get their own empty group, which keeps the AND semantics when several tags are selected — previously such a tag was silently ignored and widened the result set.
Known limitation: scenes created by the AI *before* this change are not tagged retroactively.
## Forum
Forum: https://community.gladysassistant.com/t/pouvoir-filtrer-les-scenes-qui-ont-ete-generees-par-lia/10817
### Checklist
- [x] Tests pass: `cd server && npm run coverage` (Codecov requires 100% coverage on changed lines) and Cypress (`npm run cypress:run`) if the UI changed
- [x] Linter and prettier pass on both front and server (`npm run eslint`, `npm run prettier`)
- [x] No undocumented breaking change
Coverage on the changed files is 100% statements/branches/functions/lines for `lib/scene/scene.get.js` and `utils/constants.js`; the only uncovered lines reported in `services/mcp/lib/buildSchemas.js` are pre-existing ones in the `device.turn-on-off` tool, outside this diff. Cypress was not re-run because no front-end file changed.
7 tests were added: the AI tag being applied with and without model-supplied tags, deduplication and canonical casing, exact-vs-substring tag matching, and filtering on a tag no scene carries.
## Summary by CodeRabbit
* **New Features**
* Scenes created through the AI scene creation tool are automatically tagged “AI.”
* Existing tags are preserved, while duplicate AI tags are avoided.
* **Bug Fixes**
* Scene searches now match tag names exactly rather than returning partial matches.
* Searches requiring multiple tags now correctly return no results when any requested tag is missing.
Feel free to follow the PR, test (optional, especially for small requests) and give your feedback here if needed.