update dependencies
This commit is contained in:
+12
-6
@@ -1,6 +1,6 @@
|
||||
use crate::mcp::MCPClient;
|
||||
use ollama_rs::Ollama;
|
||||
use ollama_rs::error::{OllamaError};
|
||||
use ollama_rs::error::OllamaError;
|
||||
use ollama_rs::generation::chat::ChatMessage;
|
||||
use ollama_rs::generation::chat::request::ChatMessageRequest;
|
||||
use ollama_rs::generation::completion::request::GenerationRequest;
|
||||
@@ -102,13 +102,13 @@ pub enum ChatError {
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum RestrictedToolCallResult {
|
||||
Granted(CallToolResult),
|
||||
Denied
|
||||
Denied,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct ToolUsage {
|
||||
pub call: ToolCall,
|
||||
pub result: RestrictedToolCallResult
|
||||
pub result: RestrictedToolCallResult,
|
||||
}
|
||||
|
||||
impl AgentChat {
|
||||
@@ -255,10 +255,14 @@ impl AgentChat {
|
||||
.call_tool(tool_call, &mut permission_request_callback)
|
||||
.await?;
|
||||
|
||||
tool_usages.push(ToolUsage{call: tool_call.clone(), result: restricted_result.clone()});
|
||||
tool_usages.push(ToolUsage {
|
||||
call: tool_call.clone(),
|
||||
result: restricted_result.clone(),
|
||||
});
|
||||
|
||||
// serialize structured content if it exists
|
||||
if let RestrictedToolCallResult::Granted(result) = restricted_result.clone() && let Some(structured_content) = result.structured_content
|
||||
if let RestrictedToolCallResult::Granted(result) = restricted_result.clone()
|
||||
&& let Some(structured_content) = result.structured_content
|
||||
{
|
||||
log::debug!("structured content: {structured_content:#?}");
|
||||
|
||||
@@ -272,7 +276,9 @@ impl AgentChat {
|
||||
.filter_map(|content| content.as_text())
|
||||
.map(|text_content| text_content.text.clone())
|
||||
.collect::<Vec<_>>(),
|
||||
RestrictedToolCallResult::Denied => vec![String::from("Tool Permission Denied by the user")],
|
||||
RestrictedToolCallResult::Denied => {
|
||||
vec![String::from("Tool Permission Denied by the user")]
|
||||
}
|
||||
};
|
||||
|
||||
log::debug!("contents: {contents:#?}");
|
||||
|
||||
Reference in New Issue
Block a user