@@ -15,7 +15,6 @@ use codex_core::features::Feature;
1515use codex_core:: git_info:: current_branch_name;
1616use codex_core:: git_info:: local_git_branches;
1717use codex_core:: models_manager:: manager:: ModelsManager ;
18- use codex_core:: models_manager:: model_family:: ModelFamily ;
1918use codex_core:: project_doc:: DEFAULT_PROJECT_DOC_FILENAME ;
2019use codex_core:: protocol:: AgentMessageDeltaEvent ;
2120use codex_core:: protocol:: AgentMessageEvent ;
@@ -291,7 +290,7 @@ pub(crate) struct ChatWidgetInit {
291290 pub ( crate ) models_manager : Arc < ModelsManager > ,
292291 pub ( crate ) feedback : codex_feedback:: CodexFeedback ,
293292 pub ( crate ) is_first_run : bool ,
294- pub ( crate ) model_family : ModelFamily ,
293+ pub ( crate ) model : String ,
295294}
296295
297296#[ derive( Default ) ]
@@ -316,7 +315,7 @@ pub(crate) struct ChatWidget {
316315 bottom_pane : BottomPane ,
317316 active_cell : Option < Box < dyn HistoryCell > > ,
318317 config : Config ,
319- model_family : ModelFamily ,
318+ model : String ,
320319 auth_manager : Arc < AuthManager > ,
321320 models_manager : Arc < ModelsManager > ,
322321 session_header : SessionHeader ,
@@ -608,12 +607,10 @@ impl ChatWidget {
608607 }
609608
610609 fn context_remaining_percent ( & self , info : & TokenUsageInfo ) -> Option < i64 > {
611- info. model_context_window
612- . or ( self . model_family . context_window )
613- . map ( |window| {
614- info. last_token_usage
615- . percent_of_context_window_remaining ( window)
616- } )
610+ info. model_context_window . map ( |window| {
611+ info. last_token_usage
612+ . percent_of_context_window_remaining ( window)
613+ } )
617614 }
618615
619616 fn context_used_tokens ( & self , info : & TokenUsageInfo , percent_known : bool ) -> Option < i64 > {
@@ -681,7 +678,7 @@ impl ChatWidget {
681678
682679 if high_usage
683680 && !self . rate_limit_switch_prompt_hidden ( )
684- && self . model_family . get_model_slug ( ) != NUDGE_MODEL_SLUG
681+ && self . model != NUDGE_MODEL_SLUG
685682 && !matches ! (
686683 self . rate_limit_switch_prompt,
687684 RateLimitSwitchPromptState :: Shown
@@ -715,9 +712,6 @@ impl ChatWidget {
715712 self . stream_controller = None ;
716713 self . maybe_show_pending_rate_limit_prompt ( ) ;
717714 }
718- pub ( crate ) fn get_model_family ( & self ) -> ModelFamily {
719- self . model_family . clone ( )
720- }
721715
722716 fn on_error ( & mut self , message : String ) {
723717 self . finalize_turn ( ) ;
@@ -1420,11 +1414,10 @@ impl ChatWidget {
14201414 models_manager,
14211415 feedback,
14221416 is_first_run,
1423- model_family ,
1417+ model ,
14241418 } = common;
1425- let model_slug = model_family. get_model_slug ( ) . to_string ( ) ;
14261419 let mut config = config;
1427- config. model = Some ( model_slug . clone ( ) ) ;
1420+ config. model = Some ( model . clone ( ) ) ;
14281421 let mut rng = rand:: rng ( ) ;
14291422 let placeholder = EXAMPLE_PROMPTS [ rng. random_range ( 0 ..EXAMPLE_PROMPTS . len ( ) ) ] . to_string ( ) ;
14301423 let codex_op_tx = spawn_agent ( config. clone ( ) , app_event_tx. clone ( ) , conversation_manager) ;
@@ -1445,10 +1438,10 @@ impl ChatWidget {
14451438 } ) ,
14461439 active_cell : None ,
14471440 config,
1448- model_family ,
1441+ model : model . clone ( ) ,
14491442 auth_manager,
14501443 models_manager,
1451- session_header : SessionHeader :: new ( model_slug ) ,
1444+ session_header : SessionHeader :: new ( model ) ,
14521445 initial_user_message : create_initial_user_message (
14531446 initial_prompt. unwrap_or_default ( ) ,
14541447 initial_images,
@@ -1506,10 +1499,9 @@ impl ChatWidget {
15061499 auth_manager,
15071500 models_manager,
15081501 feedback,
1509- model_family ,
1502+ model ,
15101503 ..
15111504 } = common;
1512- let model_slug = model_family. get_model_slug ( ) . to_string ( ) ;
15131505 let mut rng = rand:: rng ( ) ;
15141506 let placeholder = EXAMPLE_PROMPTS [ rng. random_range ( 0 ..EXAMPLE_PROMPTS . len ( ) ) ] . to_string ( ) ;
15151507
@@ -1532,10 +1524,10 @@ impl ChatWidget {
15321524 } ) ,
15331525 active_cell : None ,
15341526 config,
1535- model_family ,
1527+ model : model . clone ( ) ,
15361528 auth_manager,
15371529 models_manager,
1538- session_header : SessionHeader :: new ( model_slug ) ,
1530+ session_header : SessionHeader :: new ( model ) ,
15391531 initial_user_message : create_initial_user_message (
15401532 initial_prompt. unwrap_or_default ( ) ,
15411533 initial_images,
@@ -2249,22 +2241,20 @@ impl ChatWidget {
22492241
22502242 pub ( crate ) fn add_status_output ( & mut self ) {
22512243 let default_usage = TokenUsage :: default ( ) ;
2252- let ( total_usage, context_usage) = if let Some ( ti) = & self . token_info {
2253- ( & ti. total_token_usage , Some ( & ti. last_token_usage ) )
2254- } else {
2255- ( & default_usage, Some ( & default_usage) )
2256- } ;
2244+ let token_info = self . token_info . as_ref ( ) ;
2245+ let total_usage = token_info
2246+ . map ( |ti| & ti. total_token_usage )
2247+ . unwrap_or ( & default_usage) ;
22572248 self . add_to_history ( crate :: status:: new_status_output (
22582249 & self . config ,
22592250 self . auth_manager . as_ref ( ) ,
2260- & self . model_family ,
2251+ token_info ,
22612252 total_usage,
2262- context_usage,
22632253 & self . conversation_id ,
22642254 self . rate_limit_snapshot . as_ref ( ) ,
22652255 self . plan_type ,
22662256 Local :: now ( ) ,
2267- self . model_family . get_model_slug ( ) ,
2257+ & self . model ,
22682258 ) ) ;
22692259 }
22702260
@@ -2417,7 +2407,6 @@ impl ChatWidget {
24172407 /// Open a popup to choose a quick auto model. Selecting "All models"
24182408 /// opens the full picker with every available preset.
24192409 pub ( crate ) fn open_model_popup ( & mut self ) {
2420- let current_model = self . model_family . get_model_slug ( ) . to_string ( ) ;
24212410 let presets: Vec < ModelPreset > =
24222411 // todo(aibrahim): make this async function
24232412 match self . models_manager . try_list_models ( & self . config ) {
@@ -2434,9 +2423,9 @@ impl ChatWidget {
24342423
24352424 let current_label = presets
24362425 . iter ( )
2437- . find ( |preset| preset. model == current_model )
2426+ . find ( |preset| preset. model == self . model )
24382427 . map ( |preset| preset. display_name . to_string ( ) )
2439- . unwrap_or_else ( || current_model . clone ( ) ) ;
2428+ . unwrap_or_else ( || self . model . clone ( ) ) ;
24402429
24412430 let ( mut auto_presets, other_presets) : ( Vec < ModelPreset > , Vec < ModelPreset > ) = presets
24422431 . into_iter ( )
@@ -2462,7 +2451,7 @@ impl ChatWidget {
24622451 SelectionItem {
24632452 name : preset. display_name . clone ( ) ,
24642453 description,
2465- is_current : model == current_model ,
2454+ is_current : model == self . model ,
24662455 is_default : preset. is_default ,
24672456 actions,
24682457 dismiss_on_select : true ,
@@ -2525,12 +2514,11 @@ impl ChatWidget {
25252514 return ;
25262515 }
25272516
2528- let current_model = self . model_family . get_model_slug ( ) . to_string ( ) ;
25292517 let mut items: Vec < SelectionItem > = Vec :: new ( ) ;
25302518 for preset in presets. into_iter ( ) {
25312519 let description =
25322520 ( !preset. description . is_empty ( ) ) . then_some ( preset. description . to_string ( ) ) ;
2533- let is_current = preset. model == current_model ;
2521+ let is_current = preset. model == self . model ;
25342522 let single_supported_effort = preset. supported_reasoning_efforts . len ( ) == 1 ;
25352523 let preset_for_action = preset. clone ( ) ;
25362524 let actions: Vec < SelectionAction > = vec ! [ Box :: new( move |tx| {
@@ -2656,7 +2644,7 @@ impl ChatWidget {
26562644 . or ( Some ( default_effort) ) ;
26572645
26582646 let model_slug = preset. model . to_string ( ) ;
2659- let is_current_model = self . model_family . get_model_slug ( ) == preset. model ;
2647+ let is_current_model = self . model == preset. model ;
26602648 let highlight_choice = if is_current_model {
26612649 self . config . model_reasoning_effort
26622650 } else {
@@ -3246,9 +3234,9 @@ impl ChatWidget {
32463234 }
32473235
32483236 /// Set the model in the widget's config copy.
3249- pub ( crate ) fn set_model ( & mut self , model : & str , model_family : ModelFamily ) {
3237+ pub ( crate ) fn set_model ( & mut self , model : & str ) {
32503238 self . session_header . set_model ( model) ;
3251- self . model_family = model_family ;
3239+ self . model = model . to_string ( ) ;
32523240 }
32533241
32543242 pub ( crate ) fn add_info_message ( & mut self , message : String , hint : Option < String > ) {
0 commit comments