add function to remove history from AgentChat
This commit is contained in:
@@ -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)?
|
||||
}
|
||||
|
||||
+13
-1
@@ -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,19 @@ 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![],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remove_history(&mut self) {
|
||||
self.message_history = vec![];
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user