summaryrefslogtreecommitdiffstats
path: root/src/function.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-11-09 07:39:21 +0800
committerGitHub <noreply@github.com>2024-11-09 07:39:21 +0800
commitb2dbd73b8c8938105246f04e6ebcd68221740bd7 (patch)
tree00e677ef3da0d1a7f6ccfeb504fd30d005ecb63e /src/function.rs
parent58dde85033cff3f7b08fb7ae997f9e124ad52955 (diff)
downloadaichat-b2dbd73b8c8938105246f04e6ebcd68221740bd7.tar.gz
refactor: path related functions (#981)
Diffstat (limited to 'src/function.rs')
-rw-r--r--src/function.rs11
1 files changed, 7 insertions, 4 deletions
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<PathBuf> = 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 {