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>>,
|
should_stop: Arc<Mutex<bool>>,
|
||||||
) -> Result<(), RecordingError> {
|
) -> Result<(), RecordingError> {
|
||||||
let stream = match sample_format {
|
let stream = match sample_format {
|
||||||
SampleFormat::I8 => {
|
SampleFormat::I8 => build_stream::<i8>(mic, device_config, samples.clone(), sample_format)?,
|
||||||
build_stream::<i8>(mic, device_config, samples.clone(), sample_format)?
|
|
||||||
}
|
|
||||||
SampleFormat::I16 => {
|
SampleFormat::I16 => {
|
||||||
build_stream::<i16>(mic, device_config, samples.clone(), sample_format)?
|
build_stream::<i16>(mic, device_config, samples.clone(), sample_format)?
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -212,7 +212,6 @@ impl AgentChat {
|
|||||||
Ok(())
|
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>>(
|
pub async fn message<C: Future<Output = PermissionAnswer>>(
|
||||||
&mut self,
|
&mut self,
|
||||||
user_message: String,
|
user_message: String,
|
||||||
@@ -373,6 +372,15 @@ impl AgentChat {
|
|||||||
mcp_server_data.client.call_tool(request_params).await?,
|
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)]
|
#[cfg(test)]
|
||||||
|
|||||||
Reference in New Issue
Block a user