diff options
| author | sigoden <sigoden@gmail.com> | 2024-07-03 10:15:47 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-07-03 10:15:47 +0800 |
| commit | e63441b1e4139007a244a8f419cda73368b11ec7 (patch) | |
| tree | 338047033585b0302f14984eaf85c8c6f2622be6 /src | |
| parent | 3de95f04d8ec682c811c079914e77d5ffb0db2d0 (diff) | |
| download | aichat-e63441b1e4139007a244a8f419cda73368b11ec7.tar.gz | |
refactor: improve function calling (#680)
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/mod.rs | 4 | ||||
| -rw-r--r-- | src/function.rs | 4 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 6725c93..375faba 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -532,9 +532,7 @@ impl Config { "function_calling" => { let value = value.parse().with_context(|| "Invalid value")?; if value && self.functions.is_empty() { - bail!( - "Cannot enable function_calling because there are no functions installed." - ) + bail!("Function calling cannot be enabled because no functions are installed.") } self.function_calling = value; } diff --git a/src/function.rs b/src/function.rs index a8c193a..fcb4c93 100644 --- a/src/function.rs +++ b/src/function.rs @@ -222,9 +222,9 @@ impl ToolCall { let output = if is_dangerously { if *IS_STDOUT_TERMINAL { - println!("{prompt}"); + println!("{}", dimmed_text(&prompt)); let answer = Text::new("[1] Run, [2] Run & Retrieve, [3] Skip:") - .with_default("2") + .with_default("1") .with_validator(|input: &str| match matches!(input, "1" | "2" | "3") { true => Ok(Validation::Valid), false => Ok(Validation::Invalid( |
