fix: address self-review findings

This commit is contained in:
Matt Van Horn
2026-07-12 01:26:59 -07:00
parent f3a85558d8
commit d6bdb25f58
5 changed files with 54 additions and 3 deletions
+25
View File
@@ -4,6 +4,7 @@ import {
isAihubmixStandardBaseURL,
resolveBaseURL,
supportsPromptCaching,
supportsTemperature,
} from "@/lib/ai-providers"
import { extractAihubmixModelIds } from "@/lib/aihubmix-models"
@@ -182,6 +183,30 @@ describe("supportsPromptCaching", () => {
})
})
describe("supportsTemperature", () => {
it.each([
"claude-opus-4-7-20260416",
"anthropic.claude-opus-4-7-v1:0",
"us.anthropic.claude-opus-4-8-20260528-v1:0",
"global.anthropic.claude-opus-4-8",
"anthropic/claude-opus-4.7",
"anthropic/claude-opus-4.8",
])("returns false for Claude Opus models without temperature (%s)", (modelId) => {
expect(supportsTemperature(modelId)).toBe(false)
})
it.each([
"claude-sonnet-4-5",
"anthropic.claude-3-5-sonnet-20241022-v2:0",
"gpt-4o",
"gemini-2.0-flash",
"",
"unknown-model",
])("returns true for models that may support temperature (%s)", (modelId) => {
expect(supportsTemperature(modelId)).toBe(true)
})
})
vi.mock("ollama-ai-provider-v2", () => {
const mockModel = { modelId: "test-model" }
const mockProviderFn = vi.fn(() => mockModel)