Skip to content

Commit d08f2a1

Browse files
committed
clippy
1 parent df7b9b8 commit d08f2a1

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

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

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ pub async fn chat(
432432

433433
// If modelId is specified, verify it exists before starting the chat
434434
let model_id: Option<String> = if let Some(model_name) = model_name {
435-
match MODEL_OPTIONS.iter().find(|(_, name, _)| *name == model_name) {
435+
let model_name_lower = model_name.to_lowercase();
436+
match MODEL_OPTIONS.iter().find(|(_, name, _)| name == &model_name_lower) {
436437
Some((_, _, id)) => Some(id.to_string()),
437438
None => {
438439
let available_names: Vec<&str> = MODEL_OPTIONS.iter().map(|(_, name, _)| *name).collect();
@@ -613,9 +614,9 @@ impl ChatContext {
613614
MODEL_OPTIONS
614615
.iter()
615616
.find(|(_, name, _)| *name == model_name)
616-
.map(|(_, _, id)| id.to_string())
617+
.map(|(_, _, id)| (*id).to_owned())
617618
})
618-
.or_else(|| Some(DEFAULT_MODEL_ID.to_string())),
619+
.or_else(|| Some(DEFAULT_MODEL_ID.to_owned())),
619620
};
620621
let conversation_state = if resume_conversation {
621622
let prior = std::env::current_dir()
@@ -3098,7 +3099,7 @@ impl ChatContext {
30983099
if (model_id.is_empty() && active_model_id.is_none()) || Some(*model_id) == active_model_id {
30993100
format!("{} (active)", label)
31003101
} else {
3101-
label.to_string()
3102+
(*label).to_owned()
31023103
}
31033104
})
31043105
.collect();
@@ -3129,16 +3130,9 @@ impl ChatContext {
31293130
if let Some(index) = selection {
31303131
let (label, _, model_id) = MODEL_OPTIONS[index];
31313132
let model_id_str = model_id.to_string();
3132-
3133-
if model_id == "" {
3134-
self.conversation_state.current_model_id = None;
3135-
telemetry.update_model_id(None);
3136-
// let _ = database.unset_last_used_model_id();
3137-
} else {
3138-
self.conversation_state.current_model_id = Some(model_id_str.clone());
3139-
telemetry.update_model_id(Some(model_id_str.clone()));
3140-
// let _ = database.set_last_used_model_id(model_id_str);
3141-
}
3133+
self.conversation_state.current_model_id = Some(model_id_str.clone());
3134+
telemetry.update_model_id(Some(model_id_str.clone()));
3135+
// let _ = database.set_last_used_model_id(model_id_str);
31423136

31433137
queue!(
31443138
self.output,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ impl TelemetryThread {
162162
MODEL_OPTIONS
163163
.iter()
164164
.find(|(_, name, _)| *name == model_name)
165-
.map(|(_, _, id)| id.to_string())
165+
.map(|(_, _, id)| (*id).to_owned())
166166
})
167-
.or_else(|| Some(DEFAULT_MODEL_ID.to_string()));
167+
.or_else(|| Some(DEFAULT_MODEL_ID.to_owned()));
168168
let current_model_id = Arc::new(RwLock::new(model_id));
169169
let telemetry_client = TelemetryClient::new(env, database, current_model_id.clone()).await?;
170170
let (tx, mut rx) = mpsc::unbounded_channel();

0 commit comments

Comments
 (0)