refactoring
partially implement tts for human interface
This commit is contained in:
+18
-3
@@ -1,10 +1,10 @@
|
||||
use crate::translate;
|
||||
use crate::config::OllamaModelConfig;
|
||||
use crate::tlt;
|
||||
use crate::translate;
|
||||
use ollama_rs::Ollama;
|
||||
use ollama_rs::error::OllamaError;
|
||||
use ollama_rs::models::ModelOptions;
|
||||
use ollama_rs::models::create::{CreateModelRequest, CreateModelStatus};
|
||||
use crate::tlt;
|
||||
|
||||
pub async fn create_model_from_config(
|
||||
ollama: &Ollama,
|
||||
@@ -14,7 +14,22 @@ pub async fn create_model_from_config(
|
||||
.num_ctx(config.context_size.unwrap_or(2048)) // 2048 is the ollama default.
|
||||
.temperature(config.temperature.unwrap_or(0.8)); // 0.8 is the ollama default
|
||||
|
||||
let system_prompt = config.system_prompt.clone().unwrap_or(tlt!("system_prompt"));
|
||||
let system_prompt = config
|
||||
.system_prompt
|
||||
.clone()
|
||||
.unwrap_or(tlt!("system_prompt"));
|
||||
|
||||
// print message to warn user of long waiting times
|
||||
if let Ok(models) = ollama.list_local_models().await
|
||||
&& !models.iter().any(|m| m.name == config.from_model)
|
||||
{
|
||||
let message = format!(
|
||||
"Model `{}` is not installed and will be downloaded first.",
|
||||
config.from_model
|
||||
);
|
||||
log::info!("{}", message);
|
||||
println!("{}", console::style(message).yellow().bold());
|
||||
}
|
||||
|
||||
ollama
|
||||
.create_model(
|
||||
|
||||
Reference in New Issue
Block a user