feat(desktop): 聊天区域的宽度修改add configurable conversation width (standard 960px / full 90%)#6590
Conversation
Context: - The pull request was based on an older desktop appearance implementation and conflicted with the Theme Pack migration on main-v2. Resolution: - Preserve the current Theme Pack restore path and bridge contract. - Move the conversation-width control into AppearanceOverview without restoring the removed legacy AppearanceSection. Verification: - pnpm --dir desktop/frontend typecheck - git diff --check --cached Co-authored-by: SivanCola <32437197+SivanCola@users.noreply.github.com>
Problem: - Full width could become narrower than standard in common window sizes and compounded inside nested transcript containers. - The Appearance panel could display stale localStorage state instead of the persisted desktop setting. Fix: - Apply a 960px floor to full width and keep nested transcript content at 100% of its outer container. - Treat localStorage as an early-paint cache, then reconcile from normalized desktop settings. - Centralize config normalization and add frontend, config, render, and desktop bridge regressions. Verification: - pnpm test:all - pnpm build - go vet ./... and go test ./... in the root module - go vet ./..., go build ./..., and go test ./... in the desktop module Co-authored-by: SivanCola <32437197+SivanCola@users.noreply.github.com>
|
切换区域宽度选项时出现了和之前保存并应用主题之后相同的bug:主题设置中的基础配色配置会被停用主题后的基础配色配置覆盖,造成基础配色的变更。如果方便的话还望修复一下。 @SauronSkywalker @SivanCola |
会覆盖成什么样的,有录像或者前后对比截图加操作说明吗 |
2026-07-19.212048.mp4如视频所示,就是按钮、背景色等基础配色会发生改变 |
感谢,我来弄一下 |
|
@HaoyueQin Confirmed from the video. The persisted theme pack was not changed; the generic settings refresh replaced the active pack effective base style in the live DOM after the width save completed. I opened #6694 with the follow-up fix (commit ca4a503). It centralizes configured base-appearance application so the active pack is reapplied after any settings refresh, while preserving the correct restore target when the pack is disabled. Verified with the theme-pack regression test (237 passed), the full frontend suite, typecheck, CSS checks, production build, and a browser reproduction: Spark Notebook stayed active with its Aurora effective style after switching conversation width from Standard to Full. |
Conversation Width — configurable max transcript width for the desktop chat area
English
Motivation
The desktop chat (transcript) area had a hard-coded max-width of 760px, which is narrower than industry standards (VS Code: 950px, Lobe Chat: 960px). On widescreen monitors (1920px+, ultrawide), this left excessive whitespace on both sides, wasting screen real estate.
Additionally, the CSS had three redundant
--maxwdefinitions, with only one actually taking effect, making maintenance confusing.What changed
desktop/frontend/src/styles.css--maxwdefinitions; changed default from 760px → 960pxinternal/config/config.goConversationWidth stringfield toDesktopConfiginternal/config/edit.goSetDesktopConversationWidth()setterinternal/config/render.goconversation_width(when set to"full")desktop/settings_app.goSettingsView.ConversationWidth+ startup settingsdesktop/frontend/src/lib/theme.tsConversationWidthtypes + getter/setter +initThemeintegrationdesktop/frontend/src/lib/types.tsconversationWidthtoSettingsViewandDesktopStartupSettingsViewdesktop/frontend/src/lib/bridge.tsSetDesktopConversationWidthdesktop/frontend/src/App.tsxapplyDesktopPreferencesnow applies storedconversationWidthdesktop/frontend/src/components/SettingsPanel.tsxdesktop/frontend/src/locales/{en,zh,zh-TW}.tsHow it works
A new "Conversation width" row in Settings → Appearance, between "Theme" and "Visual style", offers two options:
The setting is persisted to the desktop config file (
config.toml) under the[desktop]section asconversation_width. It syncs viaDesktopStartupSettingson startup and is applied immediately via CSS custom property--maxw.Old clients that do not know about
conversation_widthsilently ignore it (TOML spec). New clients reading old configs without the key default to"standard"(960px).Backward compatibility
"standard"(960px)Verification
npx tsc --noEmit— zero errorsgo build ./internal/config/— zero errors中文
需求背景
桌面聊天(transcript)区域的宽度此前被硬编码为 760px 的最大宽度,低于行业常见值(VS Code: 950px、Lobe Chat: 960px)。在宽屏显示器(1920px+、带鱼屏)上,两侧留白过多,浪费了屏幕空间。
此外,CSS 中存在三层冗余的
--maxw定义,只有一层实际生效,维护成本高。改动内容
desktop/frontend/src/styles.css--maxw;默认值 760px → 960pxinternal/config/config.goDesktopConfig新增ConversationWidth string字段internal/config/edit.goSetDesktopConversationWidth()setterinternal/config/render.goconversation_width的 TOML 渲染(设为"full"时写入)desktop/settings_app.goSettingsView.ConversationWidth+ 启动设置desktop/frontend/src/lib/theme.tsConversationWidth类型 + 读写函数 +initTheme集成desktop/frontend/src/lib/types.tsSettingsView和DesktopStartupSettingsView加入字段desktop/frontend/src/lib/bridge.tsSetDesktopConversationWidth接口 + mockdesktop/frontend/src/App.tsxapplyDesktopPreferences现在会应用存储的宽度值desktop/frontend/src/components/SettingsPanel.tsxdesktop/frontend/src/locales/{en,zh,zh-TW}.ts使用方式
设置 → 外观"主题"和"视觉风格"之间新增一行**"会话区域宽度"**,两个选项:
设置持久化到桌面配置文件
config.toml的[desktop]节,以conversation_width字段存储。启动时通过DesktopStartupSettings同步,立即通过 CSS 自定义属性--maxw生效。兼容性
"standard"(960px)验证
npx tsc --noEmit— 零错误go build ./internal/config/— 零错误win11实测图


Review follow-up (2026-07-19)
The review fixes are included in
43480ccfafter merging the latestmain-v2:AppearanceOverview/ Theme Pack architecture.lib/conversationWidth.ts.localStorageis now only an early-paint cache; desktop config is authoritative after startup.max(960px, 90%), so it never becomes narrower than Standard in common window sizes.Compatibility matrix
Verified
pnpm test:allpnpm buildgo vet ./...,go test ./...go vet ./...,go build ./...,go test ./...评审后修复
已合并最新
main-v2,并完成以下调整:全宽使用max(960px, 90%),避免窄窗口下反而小于标准宽度;嵌套折叠内容不再重复计算 90%;桌面配置成为权威数据源,localStorage仅用于首屏预热;当前支持的 Windows、macOS、Linux 桌面目标,以及 Classic、Workbench、Creation 布局和各类主题包均使用同一套宽度逻辑。Cache-impact: low - Only added a config field (ConversationWidth) for the desktop setting; no prompt, tool, or cache-prefix content changed
Cache-guard: go build ./internal/config/ && npx tsc --noEmit
System-prompt-review: SivanCola (no actual system prompt change, only a DesktopConfig UI field added)