feat(config): separate tui.toml for theme and keybinds (closes #437)#657
feat(config): separate tui.toml for theme and keybinds (closes #437)#657merchloubna70-dot wants to merge 5 commits into
Conversation
All system prompts were English-only, causing DeepSeek V4 to reason and respond in English even when users wrote in Chinese or other languages. Add a Language Mirror section to base.md and base.txt that instructs the model to detect the user's primary language and use it for both reasoning (thinking tokens) and the final reply.
base.txt is not referenced via include_str! in prompts.rs. Only base.md is loaded (BASE_PROMPT). Remove the redundant change to base.txt as noted by Gemini Code Assist review.
…#437) Add `TuiPrefs` struct and `KeybindPrefs` sub-struct to `settings.rs` to decouple TUI-specific preferences (theme, font_size, keybinds) from the agent/project `config.toml` so they survive project switches. - `TuiPrefs::path()` resolves to `~/.deepseek/tui.toml`; honours `DEEPSEEK_CONFIG_PATH` env-var redirect used by tests and CI. - `TuiPrefs::load()` falls back to struct defaults when the file is absent — no error, backwards-compatible. - `TuiPrefs::save()` creates `~/.deepseek/` if necessary. - `TuiPrefs::validate()` normalises theme case and rejects unknown values with a helpful message. - 8 new unit tests cover defaults, round-trip TOML serde, validation, absent-file fallback, and the save→load cycle; all pass. - `cargo check` clean (0 errors, 0 new warnings beyond expected dead-code on the new public API). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
谁家PR机器人 |
Triple-check finding: TuiPrefs never loadedThe The Recommendation: Wire |
…w-up) TuiPrefs, KeybindPrefs, and their load/save/validate methods had zero production callers — users could create ~/.deepseek/tui.toml with theme and keybind overrides, but the TUI never loaded the file. Load prefs in run_interactive, propagate via TuiOptions.tui_prefs, and store on App so the data is available to rendering and keybind resolution. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Fixed — |
The match guard at tui/ui.rs:1603 used `&& let Some(...) = ...` inside an `if` guard, which requires the `if_let_guard` nightly feature on Rust < 1.94. Reported by an external user attempting `cargo install deepseek-tui` on stable rustc — it failed with E0658. Rewrite as a plain match guard with a nested `if let` inside the arm body so the language-picker hotkeys compile on every supported rustc. Workspace also now declares `rust-version = "1.88"` to match the codebase's actual reliance on `let_chains` in if/while conditions, so users on too-old toolchains see a clear cargo error instead of a confusing rustc one. `AGENTS.md` and `CLAUDE.md` gain a "stable Rust only" section documenting the trap and how to rewrite around it. Also annotate the deferred `TuiPrefs` (#657) and `handoff::THRESHOLDS` (#667) APIs with `#[allow(dead_code)]` so CI's `-D warnings` flag stays green while the call sites are staged for v0.8.13. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Explicitly read tui_prefs.theme so the field is not completely dead storage. The full light/system palette variant is a follow-up; the read establishes that theme is consulted at construction time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Added explicit read of |
The match guard at tui/ui.rs:1603 used `&& let Some(...) = ...` inside an `if` guard, which requires the `if_let_guard` nightly feature on Rust < 1.94. Reported by an external user attempting `cargo install deepseek-tui` on stable rustc — it failed with E0658. Rewrite as a plain match guard with a nested `if let` inside the arm body so the language-picker hotkeys compile on every supported rustc. Workspace also now declares `rust-version = "1.88"` to match the codebase's actual reliance on `let_chains` in if/while conditions, so users on too-old toolchains see a clear cargo error instead of a confusing rustc one. `AGENTS.md` and `CLAUDE.md` gain a "stable Rust only" section documenting the trap and how to rewrite around it. Also annotate the deferred `TuiPrefs` (Hmbown#657) and `handoff::THRESHOLDS` (Hmbown#667) APIs with `#[allow(dead_code)]` so CI's `-D warnings` flag stays green while the call sites are staged for v0.8.13. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Wires the previously-dormant `theme` setting (Hmbown#657 follow-up) into the live Settings struct so the choice survives restart. `/theme` opens an interactive picker with live preview; `/theme <name>` switches and persists non-interactively. Most render sites use bare `palette::TEXT_BODY` / `DEEPSEEK_INK` / `BORDER_COLOR` constants rather than reading `app.ui_theme`, so simply adding new UiTheme variants only repaints ~20% of surfaces. The fix is a third stage in ColorCompatBackend (alongside the existing dark<->light and truecolor<->256 stages) that rewrites every well-known dark-palette constant to the corresponding UiTheme slot for the active preset. The remap is a no-op for System / Whale / WhaleLight, so legacy dark/light flows stay byte-identical. Settings: theme = system | dark | light | catppuccin-mocha | tokyo-night | dracula | gruvbox-dark. Unknown values normalise to system. background_color still overlays on top. Tests: new coverage in theme_picker and palette; pinned make_app() in footer tests to ThemeId::System after App::new (matching the existing default_model pin) since App::new now honors settings.theme.
|
This PR was opened before the v0.8.41 rebrand and is now stale. Feel free to rebase onto current |
Summary
Implements issue #437 — decouple TUI-specific preferences from the agent/project
config.tomlso they survive project switches.TuiPrefsstruct andKeybindPrefssub-struct tocrates/tui/src/settings.rs~/.deepseek/tui.tomlviaTuiPrefs::load(); falls back to struct defaults when absent (backwards-compatible — no behaviour change for existing users)theme(dark|light|system),font_size(u16,0= terminal default), and a[keybinds]table with optional overrides forsubmit,new_line,command_palette,cancel,toggle_sidebarTuiPrefs::save()persists preferences back to disk, creating~/.deepseek/if neededTuiPrefs::validate()normalises theme casing and rejects unknown values with a helpful error messageDEEPSEEK_CONFIG_PATHenv-var redirect used by tests and CI (same pattern asSettings::path())Example
~/.deepseek/tui.tomlTest plan
settings::tests:tui_prefs_defaults_are_dark_theme_zero_fonttui_prefs_validate_accepts_known_themestui_prefs_validate_normalises_theme_casetui_prefs_validate_rejects_unknown_themetui_prefs_round_trips_through_tomltui_prefs_load_returns_defaults_when_file_absenttui_prefs_save_and_load_round_triptui_prefs_path_uses_home_deepseek_subdir_by_defaultsettings::testspass (cargo test -p deepseek-tui "settings::tests")cargo +nightly checkclean — 0 errors🤖 Generated with Claude Code