| 972 | } |
| 973 | |
| 974 | fn clear_context_for_node_ids( |
| 975 | context: &mut graphbit_core::types::WorkflowContext, |
| 976 | node_ids: &std::collections::HashSet<String>, |
| 977 | ) { |
| 978 | let id_name_map = context |
| 979 | .metadata |
| 980 | .get("node_id_to_name") |
| 981 | .and_then(|v| v.as_object()) |
| 982 | .cloned(); |
| 983 | |
| 984 | for node_id in node_ids { |
| 985 | context.node_outputs.remove(node_id); |
| 986 | context.variables.remove(node_id); |
| 987 | context.metadata.remove(&format!("node_response_{node_id}")); |
| 988 | |
| 989 | if let Some(node_name_value) = id_name_map |
| 990 | .as_ref() |
| 991 | .and_then(|map| map.get(node_id)) |
| 992 | .and_then(|v| v.as_str()) |
| 993 | { |
| 994 | context.node_outputs.remove(node_name_value); |
| 995 | context.variables.remove(node_name_value); |
| 996 | context |
| 997 | .metadata |
| 998 | .remove(&format!("node_response_{node_name_value}")); |
| 999 | } |
| 1000 | } |
| 1001 | } |
| 1002 | |
| 1003 | async fn rerun_streaming_downstream_after_tool_resolution( |
| 1004 | mut context: graphbit_core::types::WorkflowContext, |