@@ -27,6 +27,9 @@ pub struct ModelInfo {
2727 /// Display name
2828 #[ serde( skip_serializing_if = "Option::is_none" ) ]
2929 pub model_name : Option < String > ,
30+ /// Description of the model
31+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
32+ pub description : Option < String > ,
3033 /// Actual model id to send in the API
3134 pub model_id : String ,
3235 /// Size of the model's context window, in tokens
@@ -42,6 +45,7 @@ impl ModelInfo {
4245 . map_or ( default_context_window ( ) , |tokens| tokens as usize ) ;
4346 Self {
4447 model_id : model. model_id ( ) . to_string ( ) ,
48+ description : model. description . clone ( ) ,
4549 model_name : model. model_name ( ) . map ( |s| s. to_string ( ) ) ,
4650 context_window_tokens,
4751 }
@@ -51,6 +55,7 @@ impl ModelInfo {
5155 pub fn from_id ( model_id : String ) -> Self {
5256 Self {
5357 model_id,
58+ description : None ,
5459 model_name : None ,
5560 context_window_tokens : 200_000 ,
5661 }
@@ -59,6 +64,12 @@ impl ModelInfo {
5964 pub fn display_name ( & self ) -> & str {
6065 self . model_name . as_deref ( ) . unwrap_or ( & self . model_id )
6166 }
67+
68+ pub fn description ( & self ) -> Option < & str > {
69+ self . description
70+ . as_deref ( )
71+ . and_then ( |d| if d. is_empty ( ) { None } else { Some ( d) } )
72+ }
6273}
6374
6475/// Command-line arguments for model selection operations
@@ -95,10 +106,17 @@ pub async fn select_model(os: &Os, session: &mut ChatSession) -> Result<Option<C
95106 . iter ( )
96107 . map ( |model| {
97108 let display_name = model. display_name ( ) ;
109+ let description = model. description ( ) ;
98110 if Some ( model. model_id . as_str ( ) ) == active_model_id {
99- format ! ( "{} (active)" , display_name)
111+ if let Some ( desc) = description {
112+ format ! ( "{} (active) | {}" , display_name, desc)
113+ } else {
114+ format ! ( "{} (active)" , display_name)
115+ }
116+ } else if let Some ( desc) = description {
117+ format ! ( "{} | {}" , display_name, desc)
100118 } else {
101- display_name. to_owned ( )
119+ display_name. to_string ( )
102120 }
103121 } )
104122 . collect ( ) ;
@@ -194,11 +212,13 @@ fn get_fallback_models() -> Vec<ModelInfo> {
194212 ModelInfo {
195213 model_name: Some ( "claude-sonnet-4" . to_string( ) ) ,
196214 model_id: "claude-sonnet-4" . to_string( ) ,
215+ description: None ,
197216 context_window_tokens: 200_000 ,
198217 } ,
199218 ModelInfo {
200219 model_name: Some ( "claude-3.7-sonnet" . to_string( ) ) ,
201220 model_id: "claude-3.7-sonnet" . to_string( ) ,
221+ description: None ,
202222 context_window_tokens: 200_000 ,
203223 } ,
204224 ]
0 commit comments