mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 21:53:43 +00:00
fix(agents): extend cache-ttl eligibility for moonshot and zai
Co-authored-by: lailoo <lailoo@users.noreply.github.com>
This commit is contained in:
30
src/agents/pi-embedded-runner/cache-ttl.test.ts
Normal file
30
src/agents/pi-embedded-runner/cache-ttl.test.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { isCacheTtlEligibleProvider } from "./cache-ttl.js";
|
||||
|
||||
describe("isCacheTtlEligibleProvider", () => {
|
||||
it("allows anthropic", () => {
|
||||
expect(isCacheTtlEligibleProvider("anthropic", "claude-sonnet-4-20250514")).toBe(true);
|
||||
});
|
||||
|
||||
it("allows moonshot and zai providers", () => {
|
||||
expect(isCacheTtlEligibleProvider("moonshot", "kimi-k2.5")).toBe(true);
|
||||
expect(isCacheTtlEligibleProvider("zai", "glm-5")).toBe(true);
|
||||
});
|
||||
|
||||
it("is case-insensitive for native providers", () => {
|
||||
expect(isCacheTtlEligibleProvider("Moonshot", "Kimi-K2.5")).toBe(true);
|
||||
expect(isCacheTtlEligibleProvider("ZAI", "GLM-5")).toBe(true);
|
||||
});
|
||||
|
||||
it("allows openrouter cache-ttl models", () => {
|
||||
expect(isCacheTtlEligibleProvider("openrouter", "anthropic/claude-sonnet-4")).toBe(true);
|
||||
expect(isCacheTtlEligibleProvider("openrouter", "moonshotai/kimi-k2.5")).toBe(true);
|
||||
expect(isCacheTtlEligibleProvider("openrouter", "moonshot/kimi-k2.5")).toBe(true);
|
||||
expect(isCacheTtlEligibleProvider("openrouter", "zai/glm-5")).toBe(true);
|
||||
});
|
||||
|
||||
it("rejects unsupported providers and models", () => {
|
||||
expect(isCacheTtlEligibleProvider("openai", "gpt-4o")).toBe(false);
|
||||
expect(isCacheTtlEligibleProvider("openrouter", "openai/gpt-4o")).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user