summaryrefslogtreecommitdiffstats
path: root/src/config/agent.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-10-09 08:28:34 +0800
committerGitHub <noreply@github.com>2024-10-09 08:28:34 +0800
commita3e2c2a14718b4f23831cea9bce14ee4430dc90b (patch)
tree957cee02cd54edf030e630fee7d4bda8f1449294 /src/config/agent.rs
parent4bc74f7e9006fc7f182c9dc6ea309ea83c5bb4f9 (diff)
downloadaichat-a3e2c2a14718b4f23831cea9bce14ee4430dc90b.tar.gz
refactor: throw error if using non-exist RAG in CMD mode (#917)
Diffstat (limited to 'src/config/agent.rs')
-rw-r--r--src/config/agent.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/config/agent.rs b/src/config/agent.rs
index 813df3a..2f44477 100644
--- a/src/config/agent.rs
+++ b/src/config/agent.rs
@@ -32,6 +32,9 @@ impl Agent {
) -> Result<Self> {
let functions_dir = Config::agent_functions_dir(name)?;
let definition_file_path = functions_dir.join("index.yaml");
+ if !definition_file_path.exists() {
+ bail!("Unknown agent `{name}`");
+ }
let functions_file_path = functions_dir.join("functions.json");
let variables_path = Config::agent_variables_file(name)?;
let rag_path = Config::agent_rag_file(name, "rag")?;