summaryrefslogtreecommitdiffstats
path: root/src/config/model_info.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-11-01 10:28:54 +0800
committerGitHub <noreply@github.com>2023-11-01 10:28:54 +0800
commit7f2210dbcab017ee30e8f95771e68494b4860c59 (patch)
tree7a0c7bdc8f6930e262bf8cfdc8ffbd57aa843e40 /src/config/model_info.rs
parent64202758ec8693dd18951c554728bb5c6b7e5eeb (diff)
downloadaichat-7f2210dbcab017ee30e8f95771e68494b4860c59.tar.gz
refactor: clients/* and config.rs (#193)
- add register_clients macro to make it easier to add a new client - no create_client_config, just add const PROMPTS - move ModelInfo from clients/ to config/ - model's max_tokens are optional - improve code quanity on config/mod.rs - add/use macro config_get_fn
Diffstat (limited to 'src/config/model_info.rs')
-rw-r--r--src/config/model_info.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/config/model_info.rs b/src/config/model_info.rs
new file mode 100644
index 0000000..1f8d6f0
--- /dev/null
+++ b/src/config/model_info.rs
@@ -0,0 +1,27 @@
+#[derive(Debug, Clone)]
+pub struct ModelInfo {
+ pub client: String,
+ pub name: String,
+ pub max_tokens: Option<usize>,
+ pub index: usize,
+}
+
+impl Default for ModelInfo {
+ fn default() -> Self {
+ ModelInfo::new("", "", None, 0)
+ }
+}
+
+impl ModelInfo {
+ pub fn new(client: &str, name: &str, max_tokens: Option<usize>, index: usize) -> Self {
+ Self {
+ client: client.into(),
+ name: name.into(),
+ max_tokens,
+ index,
+ }
+ }
+ pub fn stringify(&self) -> String {
+ format!("{}:{}", self.client, self.name)
+ }
+}