feat: complete GUI overhaul with Nerd Font fix, syntax highlighting, chat redesign, tool approval, and i18n#766
feat: complete GUI overhaul with Nerd Font fix, syntax highlighting, chat redesign, tool approval, and i18n#766jwandbj wants to merge 9 commits intoHmbown:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a native GUI for DeepSeek TUI built with egui and eframe, refactoring the core logic into a shared library. The GUI features a chat interface, file explorer, and code editor. However, the submission contains several critical issues, including unresolved merge conflict markers across multiple files and widespread character encoding corruption in the TUI source. Feedback highlights significant performance bottlenecks in the GUI, such as synchronous disk I/O (reading directories and saving files) performed on the main UI thread and redundant font/style loading every frame. Additionally, the event forwarding logic is inefficient and should transition from a polling loop to an asynchronous receiver to reduce latency and CPU usage.
- Moved directory reading (std::fs::read_dir) off the UI thread by spawning a background task (tokio::task::spawn_blocking) and caching results. This prevents GUI stutter when expanding large directories. - Replaced the polling-based event forwarding loop (try_recv + sleep(50ms)) with an async receiver (tokio::sync::mpsc) to eliminate latency and unnecessary CPU usage. - Wrapped file saving (std::fs::write) in spawn_blocking to avoid blocking the UI thread during writes, especially for large files or slow disks.
|
Thanks for the GUI overhaul — the syntax-highlighting + tool-approval-modal + i18n work each look like genuinely useful self-contained slices inside the larger 3.5K-line PR. I'd like to harvest these one slice at a time in v0.8.18 and v0.9.0. The first one I'd take is the syntax-highlighting layer because it's the most self-contained; the approval-modal redesign is second because it touches user-facing flows we've been wanting to clean up. I'll drive the harvest myself rather than asking you to split — just leaving this open as the source. Will credit you on each landed slice. |
Summary
This PR delivers a significant GUI overhaul, fixing multiple visual and functional issues while adding new features to improve user experience. All changes are contained within
crates/guiandcrates/tui(prompts), and are fully backward-compatible with the existing TUI.🎨 UI & Interaction
in the file tree.file_type_color()to color files by extension (e.g.,.rsorange,.mdblue,.json/.yamlyellow).syntectwithbase16-ocean.darktheme. Addedhighlight_code()andplain_text_layout_job()(fallback for large files) for the editor.MAX_TABS = 12with automatic closing of the oldest unmodified tab; skip highlighting for files >20k chars.➤), and button gray-out during streaming.🛡️ Tool Approval
approve_tool_call/deny_tool_call.friendly_error_message()translates common API errors:🌐 Language
Languageinstruction in the system prompt (before volatile-content boundary) to ensure the model always responds in Chinese, including thinking process. Cache-stable for prefix cache hits.📁 Files Changed
crates/gui/Cargo.toml– addedsyntectdependencycrates/gui/src/theme.rs– Nerd Font Proportional fallbackcrates/gui/src/app.rs– all UI/interaction features, caching, chat, approval, error handlingcrates/tui/src/prompts.rs– Chinese locale system promptTesting
cargo test --all-featurescargo fmt --all --checkcargo clippy --all-targets --all-featuresChecklist