Optimize the agent tool execution loop
Verify control plane / verify (push) Canceled after 0s
Verify control plane / verify (pull_request) Canceled after 0s

This commit is contained in:
WebUp Cloud committed 2026-11-08 08:57:47 +08:00
1 parent 572371d7af
commit 4291adfdfb
7 files changed
+110 -7

No files matched your search

@@ -111,7 +111,7 @@ public class ModelGateway {
ArrayNode messages = body.putArray("messages");
for (JsonNode m : history) {
ObjectNode copy = ((ObjectNode) m).deepCopy();
copy.remove(List.of("native", "nativeType"));
copy.remove(List.of("native", "nativeType", "is_error"));
messages.add(copy);
}
if (withTools) body.set("tools", definitions);
@@ -135,6 +135,7 @@ public class ModelGateway {
block.put("type", "tool_result");
block.put("tool_use_id", m.path("tool_call_id").asText());
block.put("content", m.path("content").asText());
if (m.path("is_error").asBoolean(false)) block.put("is_error", true);
} else if (role.equals("assistant") && m.path("nativeType").asText().equals(type)) {
content.addAll((ArrayNode) m.get("native"));
} else {