mirror of
https://github.com/hanzoai/bot.git
synced 2026-11-01 07:38:30 +00:00
The big rebrand left a residue of HanzoBot* identifiers inside camelCase compounds (resolveHanzoBotAgentDir, HanzoBotPackageRoot, hanzoBotRoot, HanzoBotTmpDir, …) that the canonical bot-root.ts / tmp-bot-dir.ts had always exported as Bot* / bot*. The earlier \b-anchored sweep missed them because the H is mid-identifier with no word boundary. Replace HanzoBot(?=[A-Z][a-z]) → Bot (and hanzoBot equivalent) everywhere, plus HanzoBotKit → BotKit (the on-disk module is apps/shared/BotKit). Also one stray pi-tools.ts type narrowing (senderId is string|null but the target wants string|undefined) — coerce with ?? undefined. pnpm build → ✔ Build complete in 7s.
56 lines
2.0 KiB
TypeScript
56 lines
2.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { BotConfig } from "../config/config.js";
|
|
import { installModelsConfigTestHooks, withModelsTempHome } from "./models-config.e2e-harness.js";
|
|
import { ensureBotModelsJson } from "./models-config.js";
|
|
import { readGeneratedModelsJson } from "./models-config.test-utils.js";
|
|
|
|
describe("models-config", () => {
|
|
installModelsConfigTestHooks();
|
|
|
|
it("normalizes gemini 3 ids to preview for google providers", async () => {
|
|
await withModelsTempHome(async () => {
|
|
const cfg: BotConfig = {
|
|
models: {
|
|
providers: {
|
|
google: {
|
|
baseUrl: "https://generativelanguage.googleapis.com/v1beta",
|
|
apiKey: "GEMINI_KEY",
|
|
api: "google-generative-ai",
|
|
models: [
|
|
{
|
|
id: "gemini-3-pro",
|
|
name: "Gemini 3 Pro",
|
|
api: "google-generative-ai",
|
|
reasoning: true,
|
|
input: ["text", "image"],
|
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
contextWindow: 1048576,
|
|
maxTokens: 65536,
|
|
},
|
|
{
|
|
id: "gemini-3-flash",
|
|
name: "Gemini 3 Flash",
|
|
api: "google-generative-ai",
|
|
reasoning: false,
|
|
input: ["text", "image"],
|
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
contextWindow: 1048576,
|
|
maxTokens: 65536,
|
|
},
|
|
],
|
|
},
|
|
},
|
|
},
|
|
};
|
|
|
|
await ensureBotModelsJson(cfg);
|
|
|
|
const parsed = await readGeneratedModelsJson<{
|
|
providers: Record<string, { models: Array<{ id: string }> }>;
|
|
}>();
|
|
const ids = parsed.providers.google?.models?.map((model) => model.id);
|
|
expect(ids).toEqual(["gemini-3-pro-preview", "gemini-3-flash-preview"]);
|
|
});
|
|
});
|
|
});
|