From b2dbd73b8c8938105246f04e6ebcd68221740bd7 Mon Sep 17 00:00:00 2001 From: sigoden Date: Sat, 9 Nov 2024 07:39:21 +0800 Subject: refactor: path related functions (#981) --- src/function.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/function.rs') diff --git a/src/function.rs b/src/function.rs index 9c884e5..517b9eb 100644 --- a/src/function.rs +++ b/src/function.rs @@ -221,14 +221,12 @@ impl ToolCall { let mut bin_dirs: Vec = vec![]; if let Some(agent) = config.read().agent.as_ref() { - let dir = Config::agent_functions_dir(agent.name()) - .context("No agent functions dir")? - .join("bin"); + let dir = Config::agent_functions_dir(agent.name()).join("bin"); if dir.exists() { bin_dirs.push(dir); } } - bin_dirs.push(Config::functions_bin_dir().context("No functions bin dir")?); + bin_dirs.push(Config::functions_bin_dir()); let current_path = std::env::var("PATH").context("No PATH environment variable")?; let prepend_path = bin_dirs .iter() @@ -240,6 +238,11 @@ impl ToolCall { let temp_file = temp_file("-eval-", ""); envs.insert("LLM_OUTPUT".into(), temp_file.display().to_string()); + envs.insert( + "LLM_FUNCTIONS_ROOT".into(), + Config::functions_dir().display().to_string(), + ); + #[cfg(windows)] let cmd_name = polyfill_cmd_name(&cmd_name, &bin_dirs); if *IS_STDOUT_TERMINAL { -- cgit v1.2.3