Skip to content

Commit 8051420

Browse files
committed
bugbash
1 parent 296dd89 commit 8051420

File tree

3 files changed

+15
-22
lines changed

3 files changed

+15
-22
lines changed

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -281,10 +281,10 @@ impl ChatArgs {
281281
// If modelId is specified, verify it exists before starting the chat
282282
let model_id: Option<String> = if let Some(model_name) = self.model {
283283
let model_name_lower = model_name.to_lowercase();
284-
match MODEL_OPTIONS.iter().find(|(_, name, _)| name == &model_name_lower) {
285-
Some((_, _, id)) => Some((*id).to_string()),
284+
match MODEL_OPTIONS.iter().find(|(name, _)| name == &model_name_lower) {
285+
Some((_, id)) => Some((*id).to_string()),
286286
None => {
287-
let available_names: Vec<&str> = MODEL_OPTIONS.iter().map(|(_, name, _)| *name).collect();
287+
let available_names: Vec<&str> = MODEL_OPTIONS.iter().map(|(name, _)| *name).collect();
288288
bail!(
289289
"Model '{}' does not exist. Available models: {}",
290290
model_name,
@@ -436,19 +436,11 @@ const ROTATING_TIPS: [&str; 14] = [
436436
color_print::cstr! {"Customize your current chat session by choosing a model with <green!>/model</green!>"},
437437
];
438438

439-
pub const MODEL_OPTIONS: [(&str, &str, &str); 3] = [
439+
pub const MODEL_OPTIONS: [(&str, &str); 3] = [
440440
// ("Auto", ""),
441-
(
442-
"Claude Sonnet 3.5",
443-
"claude-3.5-sonnet",
444-
"CLAUDE_3_5_SONNET_20241022_V2_0",
445-
),
446-
(
447-
"Claude Sonnet 3.7",
448-
"claude-3.7-sonnet",
449-
"CLAUDE_3_7_SONNET_20250219_V1_0",
450-
),
451-
("Claude Sonnet 4.0", "claude-4-sonnet", "CLAUDE_SONNET_4_20250514_V1_0"),
441+
("claude-3.5-sonnet", "CLAUDE_3_5_SONNET_20241022_V2_0"),
442+
("claude-3.7-sonnet", "CLAUDE_3_7_SONNET_20250219_V1_0"),
443+
("claude-4-sonnet", "CLAUDE_SONNET_4_20250514_V1_0"),
452444
];
453445

454446
pub const DEFAULT_MODEL_ID: &str = "CLAUDE_3_7_SONNET_20250219_V1_0";
@@ -617,8 +609,8 @@ impl ChatContext {
617609
.and_then(|model_name| {
618610
MODEL_OPTIONS
619611
.iter()
620-
.find(|(_, name, _)| *name == model_name)
621-
.map(|(_, _, id)| (*id).to_owned())
612+
.find(|(name, _)| *name == model_name)
613+
.map(|(_, id)| (*id).to_owned())
622614
})
623615
.or_else(|| Some(DEFAULT_MODEL_ID.to_owned())),
624616
};
@@ -3124,7 +3116,7 @@ impl ChatContext {
31243116
let active_model_id = self.conversation_state.current_model_id.as_deref();
31253117
let labels: Vec<String> = MODEL_OPTIONS
31263118
.iter()
3127-
.map(|(label, _, model_id)| {
3119+
.map(|(label, model_id)| {
31283120
if (model_id.is_empty() && active_model_id.is_none()) || Some(*model_id) == active_model_id {
31293121
format!("{} (active)", label)
31303122
} else {
@@ -3134,7 +3126,7 @@ impl ChatContext {
31343126
.collect();
31353127
let default_index = MODEL_OPTIONS
31363128
.iter()
3137-
.position(|(_, _, model_id)| Some(*model_id) == active_model_id)
3129+
.position(|(_, model_id)| Some(*model_id) == active_model_id)
31383130
.unwrap_or(0);
31393131
let selection: Option<_> = match Select::with_theme(&crate::util::dialoguer_theme())
31403132
.with_prompt("Select a model for this chat session")
@@ -3157,7 +3149,7 @@ impl ChatContext {
31573149
queue!(self.output, style::ResetColor)?;
31583150

31593151
if let Some(index) = selection {
3160-
let (label, _, model_id) = MODEL_OPTIONS[index];
3152+
let (label, model_id) = MODEL_OPTIONS[index];
31613153
let model_id_str = model_id.to_string();
31623154
self.conversation_state.current_model_id = Some(model_id_str.clone());
31633155
telemetry.update_model_id(Some(model_id_str.clone()));

crates/chat-cli/src/cli/chat/prompt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub const COMMANDS: &[&str] = &[
5050
"/tools untrust",
5151
"/tools trustall",
5252
"/tools reset",
53+
"/model",
5354
"/profile",
5455
"/profile help",
5556
"/profile list",

crates/chat-cli/src/telemetry/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ impl TelemetryThread {
161161
.and_then(|model_name| {
162162
MODEL_OPTIONS
163163
.iter()
164-
.find(|(_, name, _)| *name == model_name)
165-
.map(|(_, _, id)| (*id).to_owned())
164+
.find(|(name, _)| *name == model_name)
165+
.map(|(_, id)| (*id).to_owned())
166166
})
167167
.or_else(|| Some(DEFAULT_MODEL_ID.to_owned()));
168168
let current_model_id = Arc::new(RwLock::new(model_id));

0 commit comments

Comments
 (0)