From 2174dc055f660799ed18950fac6a9006f8471fbb Mon Sep 17 00:00:00 2001 From: sigoden Date: Tue, 21 May 2024 07:56:02 +0800 Subject: refactor: change prompt for executing tool functions (#529) * refactor: change prompt for executing tool functions * add AICHAT_FUNCTION_AUTO_EXECUTE to auto confirm --- src/utils/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/utils/mod.rs') diff --git a/src/utils/mod.rs b/src/utils/mod.rs index 3ce2a78..fa67c63 100644 --- a/src/utils/mod.rs +++ b/src/utils/mod.rs @@ -35,6 +35,14 @@ pub fn get_env_name(key: &str) -> String { ) } +pub fn get_env_bool(key: &str) -> bool { + if let Ok(value) = env::var(get_env_name(key)) { + value == "1" || value == "true" + } else { + false + } +} + pub fn tokenize(text: &str) -> Vec<&str> { if text.is_ascii() { text.split_inclusive(|c: char| c.is_ascii_whitespace()) -- cgit v1.2.3