Skip to content

Commit 1cf9cda

Browse files
authored
fix: change fallback (#2615)
1 parent a62c80c commit 1cf9cda

File tree

1 file changed

+28
-14
lines changed
  • crates/chat-cli/src/cli/chat/cli

1 file changed

+28
-14
lines changed

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

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ pub async fn get_available_models(os: &Os) -> Result<(Vec<ModelInfo>, ModelInfo)
170170
Err(e) => {
171171
tracing::error!("Failed to fetch models from API: {}, using fallback list", e);
172172

173-
let models = get_fallback_models();
173+
let models = get_fallback_models(region);
174174
let default_model = models[0].clone();
175175

176176
Ok((models, default_model))
@@ -188,19 +188,33 @@ fn default_context_window() -> usize {
188188
200_000
189189
}
190190

191-
fn get_fallback_models() -> Vec<ModelInfo> {
192-
vec![
193-
ModelInfo {
194-
model_name: Some("claude-3.7-sonnet".to_string()),
195-
model_id: "claude-3.7-sonnet".to_string(),
196-
context_window_tokens: 200_000,
197-
},
198-
ModelInfo {
199-
model_name: Some("claude-sonnet-4".to_string()),
200-
model_id: "claude-sonnet-4".to_string(),
201-
context_window_tokens: 200_000,
202-
},
203-
]
191+
fn get_fallback_models(region: &str) -> Vec<ModelInfo> {
192+
match region {
193+
"eu-central-1" => vec![
194+
ModelInfo {
195+
model_name: Some("claude-sonnet-4".to_string()),
196+
model_id: "claude-sonnet-4".to_string(),
197+
context_window_tokens: 200_000,
198+
},
199+
ModelInfo {
200+
model_name: Some("claude-3.5-sonnet-v1".to_string()),
201+
model_id: "claude-3.5-sonnet-v1".to_string(),
202+
context_window_tokens: 200_000,
203+
},
204+
],
205+
_ => vec![
206+
ModelInfo {
207+
model_name: Some("claude-sonnet-4".to_string()),
208+
model_id: "claude-sonnet-4".to_string(),
209+
context_window_tokens: 200_000,
210+
},
211+
ModelInfo {
212+
model_name: Some("claude-3.7-sonnet".to_string()),
213+
model_id: "claude-3.7-sonnet".to_string(),
214+
context_window_tokens: 200_000,
215+
},
216+
],
217+
}
204218
}
205219

206220
pub fn normalize_model_name(name: &str) -> &str {

0 commit comments

Comments
 (0)