diff options
| author | sigoden <sigoden@gmail.com> | 2024-01-13 19:52:07 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-13 19:52:07 +0800 |
| commit | fe35cfd9419302f01baf9672493c0b0a4b41d889 (patch) | |
| tree | 94e763745fb7989c97af39cc1dfb44250440a5eb /src/repl | |
| parent | 4e99df4c1bd4028a77251bdb00ff23c664372b5f (diff) | |
| download | aichat-fe35cfd9419302f01baf9672493c0b0a4b41d889.tar.gz | |
feat: supports model capabilities (#297)
1. automatically switch to the model that has the necessary capabilities.
2. throw an error if the client does not have a model with the necessary capabilities
Diffstat (limited to 'src/repl')
| -rw-r--r-- | src/repl/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/repl/mod.rs b/src/repl/mod.rs index 719ef3a..832ffb4 100644 --- a/src/repl/mod.rs +++ b/src/repl/mod.rs @@ -6,7 +6,7 @@ use self::completer::ReplCompleter; use self::highlighter::ReplHighlighter; use self::prompt::ReplPrompt; -use crate::client::init_client; +use crate::client::{ensure_model_capabilities, init_client}; use crate::config::{GlobalConfig, Input, State}; use crate::render::{render_error, render_stream}; use crate::utils::{create_abort_signal, set_text, AbortSignal}; @@ -268,7 +268,8 @@ impl Repl { Input::new(text, files)? }; self.config.read().maybe_print_send_tokens(&input); - let client = init_client(&self.config)?; + let mut client = init_client(&self.config)?; + ensure_model_capabilities(client.as_mut(), input.required_capabilities())?; let output = render_stream(&input, client.as_ref(), &self.config, self.abort.clone())?; self.config.write().save_message(input, &output)?; if self.config.read().auto_copy { |
