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

未关闭 适合新手
#1,433 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@arshil42 已经在做这个了。

开始于 2026年11月15日。

  • #1434 来自 @arshil42 —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
javascript, react
领域
frontend

调研方向

从 packages/layout_editor/src/lib/themeGenerationService.js 开始,重点关注 inferMode、requestedRefinementFields 和 limitRefinementSuggestion。为列出的后续短语添加回归测试,并验证模式得以保留;完成的标准是这些细化操作切换到所请求的浅色或深色模式,同时现有行为仍然有效。

由索引模型根据 Issue 内容生成。

描述

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.

主要语言
JavaScript
星标
170
派生
397
平均合并
8 天 20 小时
30 天内合并 PR
6

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

RocketChat/EmbeddedChat 的其他 Issue

查看 RocketChat/EmbeddedChat 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。