summaryrefslogtreecommitdiffstats
path: root/src/utils
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-07-30 15:04:50 +0800
committerGitHub <noreply@github.com>2024-07-30 15:04:50 +0800
commita0d421ffc83ba97a1f99f1ba9f85a1689941d171 (patch)
tree15af76aab2baf1a2843fb98860b5a3c7099239a9 /src/utils
parentcc74be5d2163fbb1e9d57f85d5546857c6602446 (diff)
downloadaichat-a0d421ffc83ba97a1f99f1ba9f85a1689941d171.tar.gz
feat: export agent variable as `LLM_AGENT_VAR_*` (#766)
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/mod.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/utils/mod.rs b/src/utils/mod.rs
index a3aef22..6f89fbe 100644
--- a/src/utils/mod.rs
+++ b/src/utils/mod.rs
@@ -38,6 +38,10 @@ pub fn get_env_name(key: &str) -> String {
format!("{}_{key}", env!("CARGO_CRATE_NAME"),).to_ascii_uppercase()
}
+pub fn normalize_env_name(value: &str) -> String {
+ value.replace('-', "_").to_ascii_uppercase()
+}
+
pub fn estimate_token_length(text: &str) -> usize {
let words: Vec<&str> = text.unicode_words().collect();
let mut output: f32 = 0.0;