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

Aperta Adatta ai principianti
#1,433 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@arshil42 ci sta già lavorando.

Dal 15/11/2026.

  • #1434 di @arshil42 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
88/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, react
Ambito
frontend

Direzione di ricerca

Inizia da packages/layout_editor/src/lib/themeGenerationService.js, concentrandoti su inferMode, requestedRefinementFields e limitRefinementSuggestion. Aggiungi un test di regressione per le frasi di follow-up elencate e verifica che la modalità venga mantenuta; il lavoro è completato quando questi perfezionamenti passano alla modalità chiara o scura richiesta e il comportamento esistente continua a funzionare.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description:

In the layout editor's theme assistant, a follow-up request like "change it to dark" does not switch the mode when an AI provider (Ollama, OpenAI or Gemini) is used. The request is understood, then discarded.

In packages/layout_editor/src/lib/themeGenerationService.js, inferMode accepts switch|change|set|turn (it) to light|dark, but requestedRefinementFields only allows the mode field for "light/dark mode", "light/dark theme" or exactly "switch to light/dark". limitRefinementSuggestion then drops mode, both from the provider's answer and from the local parsing that is meant to take precedence.

Steps to reproduce:
  1. Open the layout editor theme assistant with an AI provider selected and generate a light theme.
  2. Send the follow-up "change it to dark".

Or directly:

limitRefinementSuggestion({ primaryHex: '#ef4444', mode: 'dark' }, 'Change it to dark');
Expected behavior:

The theme switches to dark mode, as it does for "switch to dark theme".

Actual behavior:

Nothing changes, because limitRefinementSuggestion returns {}. The same happens for "switch it to dark", "set it to dark", "turn it to light" and "change to light". The fallback provider is not affected, because it skips limitRefinementSuggestion.

I'd like to send a fix that uses the same pattern for both checks, with a regression test.

Lingua principale
JavaScript
Stelle
170
Fork
397
Merge medio
8g 20h
PR unite (30g)
6

Preparare l'ambiente

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di RocketChat/EmbeddedChat

Tutte le issue di RocketChat/EmbeddedChat

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.