Skip to content

Lightpanda: the headless browser designed for AI and automation

agent: use zenai's hasImage

Adrià Arrufat7318fbfcecdf
diff --git a/build.zig.zon b/build.zig.zon
index 8fb4eac97..b26a0257f 100644
--- a/build.zig.zon
+++ b/build.zig.zon
@@ -36,8 +36,8 @@
.hash = "sqlite3-3.53.2-DMxLWuAOAAA_Px0arJOIOaP4AKEu5prbsQgPMA35W1zz",
},
.zenai = .{
- .url = "git+https://github.com/lightpanda-io/zenai.git#b76da59f1b7c36d367a0914adf60a72ca6d87dd4",
- .hash = "zenai-0.0.0-iOY_VEm3BgDBXrcf-iedI2lNaTE5oF7vyG0AxB85b-2q",
+ .url = "git+https://github.com/lightpanda-io/zenai.git#be5d2e70d3dcc9866041dbdbcfa1f18799601a30",
+ .hash = "zenai-0.0.0-iOY_VE23BgCNT-WtrAC6BM1J_G98bSk6kD0v8g09XWYA",
},
.isocline = .{
.url = "git+https://github.com/arrufat/isocline?ref=lightpanda#832a9fe25f5f4458fcc47b5acc7c21db669c2f47",
diff --git a/src/agent/Conversation.zig b/src/agent/Conversation.zig
index 45c7b05de..5b4a8e3c4 100644
--- a/src/agent/Conversation.zig
+++ b/src/agent/Conversation.zig
@@ -85,7 +85,7 @@ fn expireImages(self: *Conversation) void {
const results = msg.tool_results orelse continue;
var stripped: ?[]zenai.provider.ToolResult = null;
for (results, 0..) |res, n| {
- if (!hasImage(res.parts orelse continue)) continue;
+ if (!zenai.provider.hasImage(res.parts orelse continue)) continue;
if (budget > 0) {
budget -= 1;
continue;
@@ -99,11 +99,6 @@ fn expireImages(self: *Conversation) void {
}
}
-fn hasImage(parts: []const zenai.provider.ContentPart) bool {
- for (parts) |part| if (part == .image) return true;
- return false;
-}
-
/// Cap history growth: expire stale images, then once history exceeds
/// `prune_high`, keep the system prompt plus the most recent `prune_keep`
/// messages, snapped to a safe boundary so a tool_call isn't split from its