diff --git a/apps/shinkai-desktop/src-tauri/src/local_shinkai_node/process_handlers/ollama_process_handler.rs b/apps/shinkai-desktop/src-tauri/src/local_shinkai_node/process_handlers/ollama_process_handler.rs index bf0a178ec..8098f8860 100644 --- a/apps/shinkai-desktop/src-tauri/src/local_shinkai_node/process_handlers/ollama_process_handler.rs +++ b/apps/shinkai-desktop/src-tauri/src/local_shinkai_node/process_handlers/ollama_process_handler.rs @@ -5,7 +5,7 @@ use tokio::sync::mpsc::Sender; use crate::local_shinkai_node::ollama_api::ollama_api_client::OllamaApiClient; use super::{ - logger::LogEntry, process_handler::{ProcessHandler, ProcessHandlerEvent}, process_utils::options_to_env + logger::LogEntry, process_handler::{ProcessHandler, ProcessHandlerEvent}, process_utils::{kill_process_by_name, options_to_env} }; #[derive(Serialize, Clone)] @@ -27,6 +27,7 @@ impl OllamaProcessHandler { pub fn new(options: Option, event_sender: Sender) -> Self { let ready_matcher = Regex::new(Self::READY_MATCHER).unwrap(); + Self::kill_llama_process(); let process_handler = ProcessHandler::new(Self::PROCESS_NAME.to_string(), event_sender, ready_matcher); OllamaProcessHandler { process_handler, @@ -96,7 +97,11 @@ impl OllamaProcessHandler { self.process_handler.is_running().await } + pub async fn kill_llama_process() { + kill_process_by_name("ollama_"); + } pub async fn kill(&self) { + Self::kill_llama_process(); self.process_handler.kill().await; } }