Skip to content

Commit 7a39c7e

Browse files
authored
revise default for fra (#258)
1 parent 51ec3a6 commit 7a39c7e

File tree

1 file changed

+23
-17
lines changed
  • crates/chat-cli/src/cli/chat

1 file changed

+23
-17
lines changed

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

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,6 @@ pub const MODEL_OPTIONS: [ModelOption; 3] = [
461461
},
462462
];
463463

464-
pub const DEFAULT_MODEL_ID: &str = "CLAUDE_SONNET_4_20250514_V1_0";
465-
466464
const GREETING_BREAK_POINT: usize = 80;
467465

468466
const POPULAR_SHORTCUTS: &str = color_print::cstr! {"<black!><green!>/help</green!> all commands <em>•</em> <green!>ctrl + j</green!> new lines <em>•</em> <green!>ctrl + s</green!> fuzzy search</black!>"};
@@ -649,19 +647,19 @@ impl ChatContext {
649647
let output_clone = output.clone();
650648

651649
let mut existing_conversation = false;
652-
let valid_model_id = match model_id {
653-
Some(id) => Some(id),
654-
None => database
655-
.settings
656-
.get_string(Setting::ChatDefaultModel)
657-
.and_then(|model_name| {
658-
MODEL_OPTIONS
659-
.iter()
660-
.find(|opt| opt.name == model_name)
661-
.map(|opt| opt.model_id.to_owned())
662-
})
663-
.or_else(|| Some(DEFAULT_MODEL_ID.to_owned())),
664-
};
650+
let valid_model_id = model_id
651+
.or_else(|| {
652+
database
653+
.settings
654+
.get_string(Setting::ChatDefaultModel)
655+
.and_then(|model_name| {
656+
MODEL_OPTIONS
657+
.iter()
658+
.find(|opt| opt.name == model_name)
659+
.map(|opt| opt.model_id.to_owned())
660+
})
661+
})
662+
.unwrap_or_else(|| default_model_id(database).to_owned());
665663

666664
let conversation_state = if resume_conversation {
667665
let prior = std::env::current_dir()
@@ -689,7 +687,7 @@ impl ChatContext {
689687
profile,
690688
Some(output_clone),
691689
tool_manager,
692-
valid_model_id,
690+
Some(valid_model_id),
693691
)
694692
.await
695693
}
@@ -701,7 +699,7 @@ impl ChatContext {
701699
profile,
702700
Some(output_clone),
703701
tool_manager,
704-
valid_model_id,
702+
Some(valid_model_id),
705703
)
706704
.await
707705
};
@@ -4244,6 +4242,14 @@ impl ChatContext {
42444242
}
42454243
}
42464244

4245+
/// Currently, Sonnet 4 is set as the default model for non-FRA users.
4246+
pub fn default_model_id(database: &Database) -> &'static str {
4247+
match database.get_auth_profile() {
4248+
Ok(Some(profile)) if profile.arn.split(':').nth(3) == Some("us-east-1") => "CLAUDE_SONNET_4_20250514_V1_0",
4249+
_ => "CLAUDE_3_7_SONNET_20250219_V1_0",
4250+
}
4251+
}
4252+
42474253
/// Display a spinner + text while waiting for an async function to finish.
42484254
async fn with_spinner<T, E, F, Fut>(
42494255
interactive: bool,

0 commit comments

Comments
 (0)