diff options
| author | sigoden <sigoden@gmail.com> | 2024-11-13 09:16:33 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-13 09:16:33 +0800 |
| commit | 0aa93fa86da428b08bdc5dba77ca76d213322524 (patch) | |
| tree | 54769a4da0789d6bedb2aa37229960beac8c4547 /src/config/agent.rs | |
| parent | 777fc02e0f4e534705c3a0decffd3eebc26ff597 (diff) | |
| download | aichat-0aa93fa86da428b08bdc5dba77ca76d213322524.tar.gz | |
refactor: don't init agent RAG/variables when using `--info` (#989)
Diffstat (limited to 'src/config/agent.rs')
| -rw-r--r-- | src/config/agent.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/config/agent.rs b/src/config/agent.rs index e16e7a7..49d5835 100644 --- a/src/config/agent.rs +++ b/src/config/agent.rs @@ -66,7 +66,7 @@ impl Agent { let rag = if rag_path.exists() { Some(Arc::new(Rag::load(config, DEFAULT_AGENT_NAME, &rag_path)?)) - } else if !definition.documents.is_empty() { + } else if !definition.documents.is_empty() && !config.read().print_info_only { let mut ans = false; if *IS_STDOUT_TERMINAL { ans = Confirm::new("The agent has the documents, init RAG?") @@ -109,6 +109,7 @@ impl Agent { pub fn init_agent_variables( agent_variables: &[AgentVariable], variables: &IndexMap<String, String>, + no_interaction: bool, ) -> Result<IndexMap<String, String>> { let mut output = IndexMap::new(); if agent_variables.is_empty() { @@ -127,6 +128,9 @@ impl Agent { output.insert(key, value); continue; } + if no_interaction { + continue; + } if *IS_STDOUT_TERMINAL { if !printed { println!("⚙ Init agent variables..."); |
