Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion packages/app/src/runtime/server/global-sync/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,44 @@ describe("normalizeProviderList", () => {
expect(result.all.get("openai")?.models["gpt-5"]).toMatchObject({
id: "gpt-5",
providerID: "openai",
capabilities: { toolcall: true, attachment: true },
capabilities: { toolcall: true, attachment: true, reasoning: true },
cost: { input: 1, output: 2 },
variants: { high: {} },
})
})

test("derives reasoning support from usable variants or a reasoning field", () => {
const makeModel = (id: string, variants: Array<{ id: string }>, compatibility?: { reasoningField: string }) => ({
id,
modelID: id,
providerID: "groq",
name: id,
capabilities: { tools: true, input: ["text"], output: ["text"] },
...(compatibility ? { compatibility } : {}),
variants,
time: { released: 1 },
cost: [],
status: "active",
enabled: true,
limit: { context: 128_000, output: 8_192 },
})
const result = normalizeProviderList(
[{ id: "groq", name: "Groq" }] as ProviderListOutput["data"],
[
makeModel("no-variants", []),
makeModel("disabled-only", [{ id: "none" }]),
makeModel("reasoning-effort", [{ id: "none" }, { id: "high" }]),
makeModel("thinking-toggle", [{ id: "thinking" }]),
makeModel("reasoning-field", [], { reasoningField: "reasoning_content" }),
] as ModelListOutput["data"],
)
const models = result.all.get("groq")?.models
expect(models?.["no-variants"]?.capabilities.reasoning).toBe(false)
expect(models?.["disabled-only"]?.capabilities.reasoning).toBe(false)
expect(models?.["reasoning-effort"]?.capabilities.reasoning).toBe(true)
expect(models?.["thinking-toggle"]?.capabilities.reasoning).toBe(true)
expect(models?.["reasoning-field"]?.capabilities.reasoning).toBe(true)
})
})

describe("normalizeProjectInfo", () => {
Expand Down
6 changes: 5 additions & 1 deletion packages/app/src/runtime/server/global-sync/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ export function normalizeProviderList(
family: model.family,
capabilities: {
temperature: false,
reasoning: false,
// V2 models expose reasoning controls as variants instead of a capability flag.
// Ignore the "none" option: it only disables reasoning.
reasoning:
model.variants.some((variant) => variant.id !== "none") ||
model.compatibility?.reasoningField !== undefined,
attachment: model.capabilities.input.some((item) => item !== "text"),
toolcall: model.capabilities.tools,
input: {
Expand Down
Loading