summaryrefslogtreecommitdiffstats
path: root/src/client/localai.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-11-02 07:08:54 +0800
committerGitHub <noreply@github.com>2023-11-02 07:08:54 +0800
commit5c7bfd92ff3e557477969be9db0638ef0d3d3659 (patch)
treedc626111b7e7f9aa1a3c4b90aab22468d61e226f /src/client/localai.rs
parent0238c8734ecadfc6172fdded0fbcf83949b198fa (diff)
downloadaichat-5c7bfd92ff3e557477969be9db0638ef0d3d3659.tar.gz
refactor: set tokens count factors (#195)
Diffstat (limited to 'src/client/localai.rs')
-rw-r--r--src/client/localai.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/client/localai.rs b/src/client/localai.rs
index 026ae27..d438388 100644
--- a/src/client/localai.rs
+++ b/src/client/localai.rs
@@ -1,4 +1,4 @@
-use super::openai::{openai_build_body, openai_tokens_formula};
+use super::openai::{openai_build_body, OPENAI_TOKENS_COUNT_FACTORS};
use super::{ExtraConfig, LocalAIClient, ModelInfo, PromptKind, PromptType, SendData};
use anyhow::Result;
@@ -45,7 +45,11 @@ impl LocalAIClient {
local_config
.models
.iter()
- .map(|v| openai_tokens_formula(ModelInfo::new(index, client, &v.name).set_max_tokens(v.max_tokens)))
+ .map(|v| {
+ ModelInfo::new(index, client, &v.name)
+ .set_max_tokens(v.max_tokens)
+ .set_tokens_count_factors(OPENAI_TOKENS_COUNT_FACTORS)
+ })
.collect()
}