feat: add model aliases + minimax shortlist

This commit is contained in:
Peter Steinberger
2025-12-26 23:26:14 +00:00
parent ae9a8ce34c
commit 5c8e1b6eef
7 changed files with 178 additions and 28 deletions

View File

@@ -393,6 +393,41 @@ describe("directive parsing", () => {
});
});
it("supports model aliases on /model directive", async () => {
await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockReset();
const storePath = path.join(home, "sessions.json");
const res = await getReplyFromConfig(
{ Body: "/model Opus", From: "+1222", To: "+1222" },
{},
{
agent: {
model: "openai/gpt-4.1-mini",
workspace: path.join(home, "clawd"),
allowedModels: [
"openai/gpt-4.1-mini",
"anthropic/claude-opus-4-5",
],
modelAliases: {
Opus: "anthropic/claude-opus-4-5",
},
},
session: { store: storePath },
},
);
const text = Array.isArray(res) ? res[0]?.text : res?.text;
expect(text).toContain("Model set to Opus");
expect(text).toContain("anthropic/claude-opus-4-5");
const store = loadSessionStore(storePath);
const entry = store.main;
expect(entry.modelOverride).toBe("claude-opus-4-5");
expect(entry.providerOverride).toBe("anthropic");
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
});
});
it("uses model override for inline /model", async () => {
await withTempHome(async (home) => {
const storePath = path.join(home, "sessions.json");