From 4ea6f3933fff4974334e3f9ecb2a423aab43a787 Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 10 Jul 2024 18:53:58 +0800 Subject: feat: adjust the way of obtaining function call results (#695) --- src/config/agent.rs | 6 ------ src/config/mod.rs | 23 ----------------------- 2 files changed, 29 deletions(-) (limited to 'src/config') 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, #[serde(skip_serializing_if = "Option::is_none")] use_tools: Option, - #[serde(skip_serializing_if = "Option::is_none")] - pub dangerously_functions_filter: Option, } 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, pub use_tools: Option, - pub dangerously_functions_filter: Option, pub agents: Vec, pub rag_embedding_model: Option, @@ -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 { self.buffer_editor .clone() -- cgit v1.2.3