@@ -432,7 +432,8 @@ pub async fn chat(
432
432
433
433
// If modelId is specified, verify it exists before starting the chat
434
434
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) {
436
437
Some ( ( _, _, id) ) => Some ( id. to_string ( ) ) ,
437
438
None => {
438
439
let available_names: Vec < & str > = MODEL_OPTIONS . iter ( ) . map ( |( _, name, _) | * name) . collect ( ) ;
@@ -613,9 +614,9 @@ impl ChatContext {
613
614
MODEL_OPTIONS
614
615
. iter ( )
615
616
. find ( |( _, name, _) | * name == model_name)
616
- . map ( |( _, _, id) | id . to_string ( ) )
617
+ . map ( |( _, _, id) | ( * id ) . to_owned ( ) )
617
618
} )
618
- . or_else ( || Some ( DEFAULT_MODEL_ID . to_string ( ) ) ) ,
619
+ . or_else ( || Some ( DEFAULT_MODEL_ID . to_owned ( ) ) ) ,
619
620
} ;
620
621
let conversation_state = if resume_conversation {
621
622
let prior = std:: env:: current_dir ( )
@@ -3098,7 +3099,7 @@ impl ChatContext {
3098
3099
if ( model_id. is_empty ( ) && active_model_id. is_none ( ) ) || Some ( * model_id) == active_model_id {
3099
3100
format ! ( "{} (active)" , label)
3100
3101
} else {
3101
- label. to_string ( )
3102
+ ( * label) . to_owned ( )
3102
3103
}
3103
3104
} )
3104
3105
. collect ( ) ;
@@ -3129,16 +3130,9 @@ impl ChatContext {
3129
3130
if let Some ( index) = selection {
3130
3131
let ( label, _, model_id) = MODEL_OPTIONS [ index] ;
3131
3132
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);
3142
3136
3143
3137
queue ! (
3144
3138
self . output,
0 commit comments