add function to remove history from AgentChat
This commit is contained in:
+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