summaryrefslogtreecommitdiffstats
path: root/src/client/localai.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-11-01 22:15:55 +0800
committerGitHub <noreply@github.com>2023-11-01 22:15:55 +0800
commitf6da06dad9b2a76016209a7d58ad923c2c72f150 (patch)
tree1c74f306c194d3289fe06ed31a39a00c27ad0ca9 /src/client/localai.rs
parentda3c541b681b140feb52b4297167ca233535fa90 (diff)
downloadaichat-f6da06dad9b2a76016209a7d58ad923c2c72f150.tar.gz
refactor: improve code quanity (#194)
- extends ModelInfo for tokens calculating - refactor config/session.rs, improve export, render, getter/setter - modify main.rs, allow --model override session.model
Diffstat (limited to 'src/client/localai.rs')
-rw-r--r--src/client/localai.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/client/localai.rs b/src/client/localai.rs
index 291fc96..026ae27 100644
--- a/src/client/localai.rs
+++ b/src/client/localai.rs
@@ -1,4 +1,4 @@
-use super::openai::openai_build_body;
+use super::openai::{openai_build_body, openai_tokens_formula};
use super::{ExtraConfig, LocalAIClient, ModelInfo, PromptKind, PromptType, SendData};
use anyhow::Result;
@@ -45,7 +45,7 @@ impl LocalAIClient {
local_config
.models
.iter()
- .map(|v| ModelInfo::new(client, &v.name, v.max_tokens, index))
+ .map(|v| openai_tokens_formula(ModelInfo::new(index, client, &v.name).set_max_tokens(v.max_tokens)))
.collect()
}