From 3ab489ebac3ebb1ac20ca56a4716785e203212e4 Mon Sep 17 00:00:00 2001 From: sigoden Date: Tue, 30 Jul 2024 21:38:25 +0800 Subject: refactor: do not abandon AICHAT_PLATFORM (#768) --- src/main.rs | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index eefdc41..3c8cf65 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,19 +54,10 @@ async fn main() -> Result<()> { } else { WorkingMode::Command }; - let mut model_id = cli.model.clone(); - if model_id.is_none() { - if let Ok(v) = env::var(get_env_name("model")) { - model_id = Some(v); - } - } setup_logger(working_mode.is_serve())?; - let config = Arc::new(RwLock::new(Config::init( - working_mode, - model_id.as_deref(), - )?)); + let config = Arc::new(RwLock::new(Config::init(working_mode)?)); let highlight = config.read().highlight; - if let Err(err) = run(config, cli, text, model_id).await { + if let Err(err) = run(config, cli, text).await { let highlight = stderr().is_terminal() && highlight; render_error(err, highlight); std::process::exit(1); @@ -74,12 +65,7 @@ async fn main() -> Result<()> { Ok(()) } -async fn run( - config: GlobalConfig, - cli: Cli, - text: Option, - model_id: Option, -) -> Result<()> { +async fn run(config: GlobalConfig, cli: Cli, text: Option) -> Result<()> { let abort_signal = create_abort_signal(); if let Some(addr) = cli.serve { @@ -143,7 +129,7 @@ async fn run( println!("{sessions}"); return Ok(()); } - if let Some(model_id) = &model_id { + if let Some(model_id) = &cli.model { config.write().set_model(model_id)?; } if cli.no_stream { -- cgit v1.2.3