mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-22 00:01:34 +00:00
fix(ai-agent): align agent_actions_success with agent_actions for mcp and websearch (#9983)
This commit is contained in:
@@ -198,6 +198,10 @@ async fn execute_mcp_tool_call(
|
||||
arguments: arguments.clone(),
|
||||
});
|
||||
|
||||
if let Some(parent_job) = ctx.parent_job {
|
||||
update_flow_status_module_with_actions(ctx.db, parent_job, actions).await?;
|
||||
}
|
||||
|
||||
match tool_result {
|
||||
Ok(result) => {
|
||||
let result_str =
|
||||
@@ -227,6 +231,10 @@ async fn execute_mcp_tool_call(
|
||||
stream_event_processor.send(event, final_events_str).await?;
|
||||
}
|
||||
|
||||
if let Some(parent_job) = ctx.parent_job {
|
||||
update_flow_status_module_with_actions_success(ctx.db, parent_job, true).await?;
|
||||
}
|
||||
|
||||
// Add tool message to conversation if chat_input_enabled
|
||||
let content = format!("Used {} tool", tool_call.function.name);
|
||||
add_tool_message_to_chat(ctx, None, &content, true).await;
|
||||
@@ -259,6 +267,10 @@ async fn execute_mcp_tool_call(
|
||||
stream_event_processor.send(event, final_events_str).await?;
|
||||
}
|
||||
|
||||
if let Some(parent_job) = ctx.parent_job {
|
||||
update_flow_status_module_with_actions_success(ctx.db, parent_job, false).await?;
|
||||
}
|
||||
|
||||
// Add tool message to conversation if chat_input_enabled
|
||||
add_tool_message_to_chat(ctx, None, &error_msg, false).await;
|
||||
}
|
||||
|
||||
@@ -1030,6 +1030,11 @@ pub async fn run_agent(
|
||||
// Add websearch tool message if websearch was used
|
||||
if used_websearch {
|
||||
actions.push(AgentAction::WebSearch {});
|
||||
if let Some(parent_job) = parent_job {
|
||||
update_flow_status_module_with_actions(db, parent_job, &actions).await?;
|
||||
update_flow_status_module_with_actions_success(db, parent_job, true)
|
||||
.await?;
|
||||
}
|
||||
messages.push(OpenAIMessage {
|
||||
role: "tool".to_string(),
|
||||
content: Some(OpenAIContent::Text(
|
||||
|
||||
Reference in New Issue
Block a user