From de5b4bf99d20f26b8620e3fe871ab0cc15d221c0 Mon Sep 17 00:00:00 2001 From: milan Date: Wed, 22 Jul 2026 19:43:50 +0200 Subject: [PATCH] add function to remove history from AgentChat --- own_mcp/src/audio/recording.rs | 4 +--- own_mcp/src/lib.rs | 2 +- own_mcp/src/mcp/chat.rs | 10 +++++++++- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/own_mcp/src/audio/recording.rs b/own_mcp/src/audio/recording.rs index ca070f2..8eafb8d 100644 --- a/own_mcp/src/audio/recording.rs +++ b/own_mcp/src/audio/recording.rs @@ -85,9 +85,7 @@ fn start_recording_blocking_with_parameters( should_stop: Arc>, ) -> Result<(), RecordingError> { let stream = match sample_format { - SampleFormat::I8 => { - build_stream::(mic, device_config, samples.clone(), sample_format)? - } + SampleFormat::I8 => build_stream::(mic, device_config, samples.clone(), sample_format)?, SampleFormat::I16 => { build_stream::(mic, device_config, samples.clone(), sample_format)? } diff --git a/own_mcp/src/lib.rs b/own_mcp/src/lib.rs index ee0c28e..fb8e3e2 100644 --- a/own_mcp/src/lib.rs +++ b/own_mcp/src/lib.rs @@ -4,4 +4,4 @@ pub mod mcp; pub use mcp::chat::AgentChat; pub use ollama_rs; -pub use rmcp; \ No newline at end of file +pub use rmcp; diff --git a/own_mcp/src/mcp/chat.rs b/own_mcp/src/mcp/chat.rs index 8339221..423a302 100644 --- a/own_mcp/src/mcp/chat.rs +++ b/own_mcp/src/mcp/chat.rs @@ -212,7 +212,6 @@ impl AgentChat { Ok(()) } - // TODO: ChatMessage only returns last tool usage, which is always empty. instead the tool usages should be collected and returned in total pub async fn message>( &mut self, user_message: String, @@ -373,6 +372,15 @@ impl AgentChat { mcp_server_data.client.call_tool(request_params).await?, )) } + + pub fn without_history(self) -> Self { + Self { + ollama_client: self.ollama_client, + model: self.model, + mcp_servers: self.mcp_servers, + message_history: vec![], + } + } } #[cfg(test)]