diff options
| author | sigoden <sigoden@gmail.com> | 2024-05-18 19:06:21 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-18 19:06:21 +0800 |
| commit | b4a40e3fedb438570770a224b890ea24f6e660a9 (patch) | |
| tree | 344b96102da7cbedf1034d023aa82599940388b1 /src/render | |
| parent | 1348a62e5f8bc140a7218fbfe1b73f990ab16101 (diff) | |
| download | aichat-b4a40e3fedb438570770a224b890ea24f6e660a9.tar.gz | |
feat: support function calling (#514)
* feat: support function calling
* fix on Windows OS
* implement multi-steps function calling
* fix on Windows OS
* add error for client not support function calling
* refactor message data structure and make claude client supporting function calling
* support reuse previous call results
* improve error handling for function calling
* use prefix `may_` as indicator for `execute` type fucntions
Diffstat (limited to 'src/render')
| -rw-r--r-- | src/render/mod.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/render/mod.rs b/src/render/mod.rs index 9487d69..054a830 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -4,12 +4,11 @@ mod stream; pub use self::markdown::{MarkdownRender, RenderOptions}; use self::stream::{markdown_stream, raw_stream}; -use crate::utils::AbortSignal; +use crate::utils::{error_text, AbortSignal}; use crate::{client::SseEvent, config::GlobalConfig}; use anyhow::Result; use is_terminal::IsTerminal; -use nu_ansi_term::{Color, Style}; use std::io::stdout; use tokio::sync::mpsc::UnboundedReceiver; @@ -30,8 +29,7 @@ pub async fn render_stream( pub fn render_error(err: anyhow::Error, highlight: bool) { let err = format!("{err:?}"); if highlight { - let style = Style::new().fg(Color::Red); - eprintln!("{}", style.paint(err)); + eprintln!("{}", error_text(&err)); } else { eprintln!("{err}"); } |
