summaryrefslogtreecommitdiffstats
path: root/src/client/common.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-04-30 08:57:22 +0800
committerGitHub <noreply@github.com>2024-04-30 08:57:22 +0800
commit8a65337d590729f96a5f3c0b35dc5a08fae5bf94 (patch)
tree7cd16d619fac2e4080f922dbeaaa1731c471af47 /src/client/common.rs
parente7fa6c5a208347b0e5aa779b3ea477f5f1fe41c6 (diff)
downloadaichat-8a65337d590729f96a5f3c0b35dc5a08fae5bf94.tar.gz
feat: add `.set max_output_tokens` (#468)
Diffstat (limited to 'src/client/common.rs')
-rw-r--r--src/client/common.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/client/common.rs b/src/client/common.rs
index 5ddaf87..ee190d5 100644
--- a/src/client/common.rs
+++ b/src/client/common.rs
@@ -115,8 +115,7 @@ macro_rules! register_client {
None
$(.or_else(|| $client::init(config)))+
.ok_or_else(|| {
- let model = config.read().model.clone();
- anyhow::anyhow!("Unknown client '{}'", &model.client_name)
+ anyhow::anyhow!("Unknown client '{}'", &config.read().model.client_name)
})
}
@@ -254,6 +253,10 @@ macro_rules! client_common_fns {
&self.model
}
+ fn model_mut(&mut self) -> &mut Model {
+ &mut self.model
+ }
+
fn set_model(&mut self, model: Model) {
self.model = model;
}
@@ -323,6 +326,8 @@ pub trait Client: Sync + Send {
fn model(&self) -> &Model;
+ fn model_mut(&mut self) -> &mut Model;
+
fn set_model(&mut self, model: Model);
fn build_client(&self) -> Result<ReqwestClient> {