agent: update zenai and default models

This commit is contained in:
Adrià Arrufat
2026-05-14 19:35:38 +02:00
parent 7ab872e7a6
commit 882ed74e89
3 changed files with 14 additions and 5 deletions

View File

@@ -39,8 +39,8 @@
.hash = "N-V-__8AABGOuAC_dhAN07kfoP4dycCFi8Bka4O-tuhriNH8",
},
.zenai = .{
.url = "git+https://github.com/lightpanda-io/zenai.git#bb9b13cc4919cfe60c349df272f68e88e2448b42",
.hash = "zenai-0.0.0-iOY_VKqVAwA8ClDiylLg0IperswehYiSztLYSf0OEOtm",
.url = "git+https://github.com/lightpanda-io/zenai.git#a1d0bd57d8920772723773f1f2346ad717b0259a",
.hash = "zenai-0.0.0-iOY_VJWTAwBt4OeEsYnTSHQBdwtY-CEshH17KAPRfGl1",
},
.isocline = .{
.url = "git+https://github.com/arrufat/isocline.git#48d94027aec0408dc58af9ca2dfedf4720870e8c",

View File

@@ -833,7 +833,7 @@ pub fn printUsageAndExit(self: *const Config, success: bool) void {
\\agent command
\\Starts an interactive AI agent that can browse the web
\\Example: {0s} agent (auto-detects API key from env)
\\Example: {0s} agent --provider anthropic --model claude-haiku-4-5-20251001
\\Example: {0s} agent --provider anthropic --model claude-sonnet-4-6
\\Example: {0s} agent --provider ollama --model gemma4
\\Example: {0s} agent --no-llm (basic PandaScript-only REPL)
\\Example: {0s} agent script.lp (replay a recorded script)

View File

@@ -190,7 +190,7 @@ pub fn init(allocator: std.mem.Allocator, app: *App, opts: Config.Agent) !*Agent
else if (opts.model) |m|
try allocator.dupe(u8, m)
else if (effective_provider) |p|
try allocator.dupe(u8, zenai.provider.defaultModel(p))
try allocator.dupe(u8, defaultModel(p))
else
try allocator.dupe(u8, "");
errdefer allocator.free(model);
@@ -1222,6 +1222,15 @@ fn envVarName(p: Config.AiProvider) []const u8 {
};
}
fn defaultModel(p: Config.AiProvider) []const u8 {
return switch (p) {
.anthropic => "claude-sonnet-4-6",
.openai => "gpt-5.5",
.gemini => "gemini-3-flash-preview",
.ollama => "gemma4",
};
}
fn promptForProvider(found: []const Config.AiProvider) !Config.AiProvider {
if (!interactiveTty()) {
log.fatal(.app, "multiple API keys detected", .{
@@ -1270,7 +1279,7 @@ fn pickModel(
return error.NoModels;
}
const default_model = zenai.provider.defaultModel(provider);
const default_model = defaultModel(provider);
var default_idx: ?usize = null;
for (ids, 0..) |id, i| if (std.mem.eql(u8, id, default_model)) {
default_idx = i;