From 6b6413b02df588faf6557053751b7e9c591539f7 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sun, 1 Dec 2024 11:35:12 +0800 Subject: feat: add cli option `--agent-variable ` (#1027) --- src/main.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 2cefaf3..77b72c2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,7 +65,7 @@ async fn run(config: GlobalConfig, cli: Cli, text: Option) -> Result<()> return serve::run(config, addr).await; } if cli.info { - config.write().print_info_only = true; + config.write().cli_info_flag = true; } if cli.list_models { @@ -98,6 +98,15 @@ async fn run(config: GlobalConfig, cli: Cli, text: Option) -> Result<()> Some(v) => v.as_str(), None => TEMP_SESSION_NAME, }); + if !cli.agent_variable.is_empty() { + config.write().cli_agent_variables = Some( + cli.agent_variable + .chunks(2) + .map(|v| (v[0].to_string(), v[1].to_string())) + .collect(), + ); + } + Config::use_agent(&config, agent, session, abort_signal.clone()).await? } else { if let Some(prompt) = &cli.prompt { -- cgit v1.2.3