Skip to content

fix(layout-editor): keep mode requests like "change it to dark" in theme refinements - #1434

Open
arshil42 wants to merge 1 commit into
RocketChat:developfrom
arshil42:fix/theme-refinement-mode-request
Open

arshil42 wants to merge 1 commit into
RocketChat:developfrom
arshil42:fix/theme-refinement-mode-request

Conversation

@arshil42

Copy link
Copy Markdown

Keep mode requests like "change it to dark" in theme refinements

Acceptance Criteria fulfillment

  • A follow-up such as "change it to dark", "switch it to dark", "set it to dark" or "turn it to light" switches the mode with Ollama, OpenAI and Gemini, not only with the fallback provider
  • "switch to dark theme" and the other requests that already worked behave the same
  • Regression test added

Fixes #1433

inferMode and requestedRefinementFields now share one MODE_REQUEST pattern (switch|change|set|turn (it) to light|dark). Before this change, the field check only knew "switch to light/dark", so limitRefinementSuggestion dropped the mode that both the provider and the local parsing had found.

Video/Screenshots

No visual change outside the theme assistant, and reproducing the bug in the UI needs an AI provider, so the new unit test covers it:

$ node --test src/lib/generateThemeFromColor.test.js   # packages/layout_editor
✔ an explicit light or dark mode refinement overrides an adapter response
✔ mode refinements without the word mode or theme are kept
...
ℹ tests 18
ℹ pass 18
ℹ fail 0

Without the fix, the new test fails:

✖ mode refinements without the word mode or theme are kept
    actual: {},
    expected: { mode: 'dark' },

PR Test Details

  • node --test src/lib/generateThemeFromColor.test.js in packages/layout_editor: 18 tests, 0 failures. This is the package's only test file, the same one yarn test runs.
  • eslint --max-warnings 0 on both changed files: no problems.

@CLAassistant

CLAassistant commented Nov 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(layout-editor): theme refinements like "change it to dark" are ignored with AI providers

2 participants