summaryrefslogtreecommitdiffstats
path: root/src/client/common.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-05-06 09:08:49 +0800
committerGitHub <noreply@github.com>2024-05-06 09:08:49 +0800
commit7c6f75a139128e77f6c0e16ee176192dfef75599 (patch)
tree4bddb77185d420eee329ebac3f5a3e34de5cf512 /src/client/common.rs
parent9b283024b47f57ad7bbf032fa015eab42f8162a9 (diff)
downloadaichat-7c6f75a139128e77f6c0e16ee176192dfef75599.tar.gz
refactor: unified access token management (#486)
Diffstat (limited to 'src/client/common.rs')
-rw-r--r--src/client/common.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/client/common.rs b/src/client/common.rs
index fb0c38e..24e6f8e 100644
--- a/src/client/common.rs
+++ b/src/client/common.rs
@@ -102,8 +102,8 @@ macro_rules! register_client {
}
}
- pub fn name(config: &$config) -> &str {
- config.name.as_deref().unwrap_or(Self::NAME)
+ pub fn name(local_config: &$config) -> &str {
+ local_config.name.as_deref().unwrap_or(Self::NAME)
}
}
@@ -184,6 +184,10 @@ macro_rules! client_common_fns {
Self::list_models(&self.config)
}
+ fn name(&self) -> &str {
+ Self::name(&self.config)
+ }
+
fn model(&self) -> &Model {
&self.model
}
@@ -259,6 +263,8 @@ pub trait Client: Sync + Send {
fn list_models(&self) -> Vec<Model>;
+ fn name(&self) -> &str;
+
fn model(&self) -> &Model;
fn model_mut(&mut self) -> &mut Model;