diff options
| author | sigoden <sigoden@gmail.com> | 2024-07-10 18:53:58 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-10 18:53:58 +0800 |
| commit | 4ea6f3933fff4974334e3f9ecb2a423aab43a787 (patch) | |
| tree | 37e27557072165ebd7a61b27e21b7e3e55d713dd /src/config | |
| parent | 48219d2808bafc88fa4fa4d6997aa9dc92e6f686 (diff) | |
| download | aichat-4ea6f3933fff4974334e3f9ecb2a423aab43a787.tar.gz | |
feat: adjust the way of obtaining function call results (#695)
Diffstat (limited to 'src/config')
| -rw-r--r-- | src/config/agent.rs | 6 | ||||
| -rw-r--r-- | src/config/mod.rs | 23 |
2 files changed, 0 insertions, 29 deletions
diff --git a/src/config/agent.rs b/src/config/agent.rs index 7a065e7..7d1a43b 100644 --- a/src/config/agent.rs +++ b/src/config/agent.rs @@ -117,10 +117,6 @@ impl Agent { &self.name } - pub fn config(&self) -> &AgentConfig { - &self.config - } - pub fn functions(&self) -> &Functions { &self.functions } @@ -211,8 +207,6 @@ pub struct AgentConfig { pub top_p: Option<f64>, #[serde(skip_serializing_if = "Option::is_none")] use_tools: Option<String>, - #[serde(skip_serializing_if = "Option::is_none")] - pub dangerously_functions_filter: Option<String>, } impl AgentConfig { diff --git a/src/config/mod.rs b/src/config/mod.rs index 154dcd9..220b7c8 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -18,7 +18,6 @@ use crate::render::{MarkdownRender, RenderOptions}; use crate::utils::*; use anyhow::{anyhow, bail, Context, Result}; -use fancy_regex::Regex; use indexmap::IndexMap; use inquire::{Confirm, Select}; use parking_lot::RwLock; @@ -107,7 +106,6 @@ pub struct Config { pub function_calling: bool, pub mapping_tools: IndexMap<String, String>, pub use_tools: Option<String>, - pub dangerously_functions_filter: Option<String>, pub agents: Vec<AgentConfig>, pub rag_embedding_model: Option<String>, @@ -170,7 +168,6 @@ impl Default for Config { function_calling: true, mapping_tools: Default::default(), use_tools: None, - dangerously_functions_filter: None, agents: vec![], rag_embedding_model: None, @@ -1146,26 +1143,6 @@ impl Config { } } - pub fn is_dangerously_function(&self, name: &str) -> bool { - if get_env_bool("no_dangerously_functions") { - return false; - } - let dangerously_functions_filter = match &self.agent { - Some(agent) => agent.config().dangerously_functions_filter.as_ref(), - None => self.dangerously_functions_filter.as_ref(), - }; - match dangerously_functions_filter { - None => false, - Some(regex) => { - let regex = match Regex::new(&format!("^({regex})$")) { - Ok(v) => v, - Err(_) => return false, - }; - regex.is_match(name).unwrap_or(false) - } - } - } - pub fn buffer_editor(&self) -> Option<String> { self.buffer_editor .clone() |
