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/main.rs | |
| 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/main.rs')
| -rw-r--r-- | src/main.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 4d199aa..5d8315d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,7 +14,7 @@ use crate::config::{Config, GlobalConfig}; use anyhow::Result; use clap::Parser; -use client::{init_client, list_models}; +use client::{ensure_model_capabilities, init_client, list_models}; use config::Input; use is_terminal::IsTerminal; use parking_lot::RwLock; @@ -114,7 +114,8 @@ fn start_directive( session.guard_save()?; } let input = Input::new(text, include.unwrap_or_default())?; - let client = init_client(config)?; + let mut client = init_client(config)?; + ensure_model_capabilities(client.as_mut(), input.required_capabilities())?; config.read().maybe_print_send_tokens(&input); let output = if no_stream { let output = client.send_message(input.clone())?; |
