improve reasoning toggle tests and refactor model capability checks

This commit is contained in:
2026-09-21 20:35:38 +02:00
parent 2014b3b73f
commit 6cb0cbcee0
5 changed files with 53 additions and 6 deletions
+9 -3
View File
@@ -1,6 +1,12 @@
// Conservative allowlist for models supporting the boolean think API.
// Unknown models remain usable for normal chat.
export function supportsReasoning(model) {
const id = String(typeof model === "string" ? model : model?.model || model?.name || "").toLowerCase().split("/").at(-1);
return /^(qwen3|deepseek-r1|deepseek-v3\.1)(:|$)/.test(id);
const reasoningFamilies = new Set(["qwen3", "deepseek-r1", "deepseek-v3.1"]);
export function getModelFamily(model) {
const id = typeof model === "string" ? model : model?.model || model?.name || model?.id || "";
return String(id).trim().toLowerCase().split("/").at(-1).split(":")[0];
}
export function supportsReasoning(model) {
return reasoningFamilies.has(getModelFamily(model));
}