()
| 67 | } |
| 68 | |
| 69 | pub async fn print_models() -> Result<()> { |
| 70 | let config_service = ensure_global_config_service().await?; |
| 71 | let models = config_service.get_ai_models().await?; |
| 72 | let global_config: bitfun_core::service::config::GlobalConfig = |
| 73 | config_service.get_config(None).await?; |
| 74 | |
| 75 | let primary_model_id = global_config.ai.default_models.primary.clone(); |
| 76 | |
| 77 | println!("AI models"); |
| 78 | println!(); |
| 79 | if models.is_empty() { |
| 80 | println!("No AI models configured."); |
| 81 | return Ok(()); |
| 82 | } |
| 83 | |
| 84 | for model in models { |
| 85 | let is_primary = primary_model_id.as_deref() == Some(model.id.as_str()); |
| 86 | let current_modes: Vec<String> = global_config |
| 87 | .ai |
| 88 | .agent_models |
| 89 | .iter() |
| 90 | .filter_map(|(mode, model_id)| (model_id == &model.id).then_some(mode.clone())) |
| 91 | .collect(); |
| 92 | |
| 93 | println!( |
| 94 | "- {}{} ({})", |
| 95 | if is_primary { "* " } else { " " }, |
| 96 | model.id, |
| 97 | if model.enabled { "enabled" } else { "disabled" } |
| 98 | ); |
| 99 | println!(" Name: {}", model.name); |
| 100 | println!(" Provider: {}", model.provider); |
| 101 | println!(" Model: {}", model.model_name); |
| 102 | if !current_modes.is_empty() { |
| 103 | println!(" Used by modes: {}", current_modes.join(", ")); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | Ok(()) |
| 108 | } |
| 109 | |
| 110 | pub async fn print_mcp_servers() -> Result<()> { |
| 111 | let config_service = ensure_global_config_service().await?; |
no test coverage detected