mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-06-11 01:25:53 -04:00
agent: use zenai envVarName helper
This commit is contained in:
@@ -39,8 +39,8 @@
|
||||
.hash = "N-V-__8AABGOuAC_dhAN07kfoP4dycCFi8Bka4O-tuhriNH8",
|
||||
},
|
||||
.zenai = .{
|
||||
.url = "git+https://github.com/lightpanda-io/zenai.git#979aa12f51e4a905e37b73d5304a3e743f9dc1e2",
|
||||
.hash = "zenai-0.0.0-iOY_VFmvAwDV5WFQ_AcUUGzkyMRsCJy17GPNfI7pUNFQ",
|
||||
.url = "git+https://github.com/lightpanda-io/zenai.git#ed860aab9f8cbd0b80d9cd72f32ed06cb98a628a",
|
||||
.hash = "zenai-0.0.0-iOY_VMCwAwBAtfcdSjNg9LpWIrJsoxGgAop2FGJPyC0D",
|
||||
},
|
||||
.isocline = .{
|
||||
.url = "git+https://github.com/arrufat/isocline.git#48d94027aec0408dc58af9ca2dfedf4720870e8c",
|
||||
|
||||
@@ -1215,7 +1215,7 @@ const Llm = struct {
|
||||
const key = zenai.provider.envApiKey(p) orelse {
|
||||
std.debug.print(
|
||||
"Missing API key for --provider {s}: set {s} — or pass --no-llm for the basic REPL.\n",
|
||||
.{ @tagName(p), envVarName(p) },
|
||||
.{ @tagName(p), zenai.provider.envVarName(p) },
|
||||
);
|
||||
return error.MissingApiKey;
|
||||
};
|
||||
@@ -1240,7 +1240,7 @@ const Llm = struct {
|
||||
break :blk null;
|
||||
},
|
||||
1 => blk: {
|
||||
std.debug.print("Detected {s} — using --provider {s}.\n", .{ envVarName(found[0].provider), @tagName(found[0].provider) });
|
||||
std.debug.print("Detected {s} — using --provider {s}.\n", .{ zenai.provider.envVarName(found[0].provider), @tagName(found[0].provider) });
|
||||
break :blk found[0];
|
||||
},
|
||||
else => try pickProvider(found[0..n]),
|
||||
@@ -1277,15 +1277,6 @@ pub fn listModels(allocator: std.mem.Allocator, opts: Config.Agent) !void {
|
||||
try w.flush();
|
||||
}
|
||||
|
||||
fn envVarName(p: Config.AiProvider) []const u8 {
|
||||
return switch (p) {
|
||||
.anthropic => "ANTHROPIC_API_KEY",
|
||||
.openai => "OPENAI_API_KEY",
|
||||
.gemini => "GOOGLE_API_KEY/GEMINI_API_KEY",
|
||||
.ollama => "<ollama>",
|
||||
};
|
||||
}
|
||||
|
||||
fn defaultModel(p: Config.AiProvider) []const u8 {
|
||||
return switch (p) {
|
||||
.anthropic => "claude-sonnet-4-6",
|
||||
|
||||
Reference in New Issue
Block a user