add function to remove history from AgentChat

This commit is contained in:
2026-07-22 19:43:50 +02:00
parent 5548dc60cc
commit de5b4bf99d
3 changed files with 11 additions and 5 deletions
+1 -3
View File
@@ -85,9 +85,7 @@ fn start_recording_blocking_with_parameters(
should_stop: Arc<Mutex<bool>>,
) -> Result<(), RecordingError> {
let stream = match sample_format {
SampleFormat::I8 => {
build_stream::<i8>(mic, device_config, samples.clone(), sample_format)?
}
SampleFormat::I8 => build_stream::<i8>(mic, device_config, samples.clone(), sample_format)?,
SampleFormat::I16 => {
build_stream::<i16>(mic, device_config, samples.clone(), sample_format)?
}
+1 -1
View File
@@ -4,4 +4,4 @@ pub mod mcp;
pub use mcp::chat::AgentChat;
pub use ollama_rs;
pub use rmcp;
pub use rmcp;
+9 -1
View File
@@ -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<C: Future<Output = PermissionAnswer>>(
&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)]