feat: add /model pro|flash shortcuts and CLI model set command#3350
feat: add /model pro|flash shortcuts and CLI model set command#3350KUK4 wants to merge 2 commits into
Conversation
- Add 'pro' and 'flash' aliases to canonical_model_name in tui config - Add 'codewhale model set' CLI subcommand with pro/flash shortcuts - Supports deepseek-v4-pro, deepseek-v4-flash, and future deepseek models
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
Thanks @KUK4 for taking the time to contribute. This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered. Please read |
There was a problem hiding this comment.
Code Review
This pull request introduces a new ModelCommand::Set subcommand to the CLI, allowing users to set a default text model with shortcuts for 'pro' and 'flash' models, and updates the TUI configuration to recognize these shortcuts. However, the review feedback notes that the current implementation of ModelCommand::Set is overly restrictive because it rejects non-DeepSeek models, which breaks the ability to set other supported providers. Additionally, a widespread character encoding issue has corrupted various non-ASCII characters (such as em-dashes, arrows, bullets, and checkmarks) into ? or ? across multiple files, which needs to be reverted.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| ModelCommand::Set { model } => { | ||
| let canonical = match model.trim().to_ascii_lowercase().as_str() { | ||
| "pro" | "deepseek-v4-pro" | "deepseek-v4pro" => "deepseek-v4-pro", | ||
| "flash" | "deepseek-v4-flash" | "deepseek-v4flash" => "deepseek-v4-flash", | ||
| other => { | ||
| if other.starts_with("deepseek") { | ||
| other | ||
| } else { | ||
| bail!( | ||
| "Invalid model '{model}'. Use 'pro', 'flash', 'deepseek-v4-pro', or 'deepseek-v4-flash'." | ||
| ); | ||
| } | ||
| } | ||
| }; | ||
| store.config.default_text_model = Some(canonical.to_string()); | ||
| store.save()?; | ||
| println!("Default model set to '{canonical}'"); | ||
| Ok(()) | ||
| } |
There was a problem hiding this comment.
The current implementation of ModelCommand::Set strictly rejects any model name that does not start with "deepseek" (unless it matches the "pro" or "flash" shortcuts). Since CodeWhale supports other providers (such as OpenAI, Anthropic, etc.), this restriction completely breaks the ability for non-DeepSeek users to set their default model (e.g., codewhale model set claude-sonnet-4-6 will fail).
We should allow any non-empty model name to be set, while still supporting the "pro" and "flash" shortcuts for DeepSeek.
ModelCommand::Set { model } => {
let trimmed = model.trim();
if trimmed.is_empty() {
bail!("Model name cannot be empty");
}
let canonical = match trimmed.to_ascii_lowercase().as_str() {
"pro" | "deepseek-v4-pro" | "deepseek-v4pro" => "deepseek-v4-pro".to_string(),
"flash" | "deepseek-v4-flash" | "deepseek-v4flash" => "deepseek-v4-flash".to_string(),
_ => trimmed.to_string(),
};
store.config.default_text_model = Some(canonical.clone());
store.save()?;
println!("Default model set to '{canonical}'");
Ok(())
}| #[arg(long, value_enum)] | ||
| provider: ProviderArg, | ||
| /// Inline value (discouraged — appears in shell history). | ||
| /// Inline value (discouraged �?appears in shell history). |
There was a problem hiding this comment.
It appears that a character encoding issue has corrupted several non-ASCII characters (such as em-dashes —, arrows →, bullets •, and checkmarks ✅) into ? or ? across multiple files in this pull request. Please restore the original UTF-8 characters to prevent corrupted help text and CLI output.
| /// Inline value (discouraged �?appears in shell history). | |
| /// Inline value (discouraged — appears in shell history). |
| �?npm: npm install -g codewhale (downloads both binaries)\n\ | ||
| �?cargo: cargo install codewhale-cli codewhale-tui --locked\n\ | ||
| �?GitHub Releases: download BOTH `codewhale-<platform>` AND \ |
- ModelCommand::Set now accepts any non-empty model name, not just deepseek* - Keeps pro/flash shortcuts for DeepSeek models - Restore UTF-8 characters corrupted by prior Set-Content Addresses review feedback on PR Hmbown#3350
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Harvest the useful model shortcut slice from PR #3350 by @KUK4 while preserving existing case-sensitive model ID behavior. The CLI now accepts model set pro or flash, and config normalization maps the short aliases to the current DeepSeek v4 IDs without rewriting already-valid model IDs. Harvested from PR #3350 by @KUK4 Co-authored-by: KUK4 <246008043+KUK4@users.noreply.github.com>
|
Thanks @KUK4 — I harvested the useful model shortcut slice into the v0.8.64 integration branch as I kept the
I am leaving this PR open until the integration branch lands so the public state stays accurate. |
|
Thanks @KUK4 — your contribution landed in
Closing this PR now that the code is on If you want to land more work and would prefer your future PRs merge cleanly without a harvest step, the |
Summary
Testing
cargo fmt --all -- --checkcargo clippy --workspace --all-targets --all-featurescargo test --workspace --all-featuresChecklist