From f9c40e52dabda7b037805c0635b84ccb6d75f5a8 Mon Sep 17 00:00:00 2001 From: sigoden Date: Fri, 3 Nov 2023 06:52:57 +0800 Subject: refactor: improve code quanity (#203) - update field name of ModelInfo - rename ModelInfo to Model --- src/client/localai.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/client/localai.rs') diff --git a/src/client/localai.rs b/src/client/localai.rs index 5cc12cc..eb4de65 100644 --- a/src/client/localai.rs +++ b/src/client/localai.rs @@ -1,5 +1,5 @@ use super::openai::{openai_build_body, OPENAI_TOKENS_COUNT_FACTORS}; -use super::{ExtraConfig, LocalAIClient, PromptType, SendData, ModelInfo}; +use super::{ExtraConfig, LocalAIClient, PromptType, SendData, Model}; use crate::utils::PromptKind; @@ -41,14 +41,14 @@ impl LocalAIClient { ), ]; - pub fn list_models(local_config: &LocalAIConfig, index: usize) -> Vec { - let client = Self::name(local_config); + pub fn list_models(local_config: &LocalAIConfig, client_index: usize) -> Vec { + let client_name = Self::name(local_config); local_config .models .iter() .map(|v| { - ModelInfo::new(index, client, &v.name) + Model::new(client_index, client_name, &v.name) .set_max_tokens(v.max_tokens) .set_tokens_count_factors(OPENAI_TOKENS_COUNT_FACTORS) }) @@ -58,7 +58,7 @@ impl LocalAIClient { fn request_builder(&self, client: &ReqwestClient, data: SendData) -> Result { let api_key = self.get_api_key().ok(); - let body = openai_build_body(data, self.model_info.name.clone()); + let body = openai_build_body(data, self.model.llm_name.clone()); let chat_endpoint = self .config -- cgit v1.2.3