From 3a3388375be05758d5f5574cce1d0f8eb7bdd604 Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 4 Dec 2024 21:03:59 +0800 Subject: refactor: improve retrieve model (#1036) - check the model type while retrieve model - select chat/reranker model even if it is missed in client models - find predefined-models for openai-compatible client with startsWith - remove client::ApiType --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 77b72c2..97fbf72 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,9 @@ mod utils; extern crate log; use crate::cli::Cli; -use crate::client::{call_chat_completions, call_chat_completions_streaming, list_chat_models}; +use crate::client::{ + call_chat_completions, call_chat_completions_streaming, list_models, ModelType, +}; use crate::config::{ ensure_parent_exists, list_agents, load_env_file, Config, GlobalConfig, Input, WorkingMode, CODE_ROLE, EXPLAIN_SHELL_ROLE, SHELL_ROLE, TEMP_SESSION_NAME, @@ -69,7 +71,7 @@ async fn run(config: GlobalConfig, cli: Cli, text: Option) -> Result<()> } if cli.list_models { - for model in list_chat_models(&config.read()) { + for model in list_models(&config.read(), ModelType::Chat) { println!("{}", model.id()); } return Ok(()); -- cgit v1.2.3