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));
}
+1 -1
View File
@@ -1,4 +1,4 @@
import {supportsReasoning} from "./modelCapabilities.js";
import {supportsReasoning} from "./modelCapabilities.js?v=20260921-reasoning-capability";
export function createReasoningToggle(button) {
let reasoningEnabled = false;
+1 -1
View File
@@ -358,7 +358,7 @@
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js" defer></script>
<script src="https://cdn.jsdelivr.net/npm/dompurify@3.0.6/dist/purify.min.js" defer></script>
<script type="module" src="/script.js?v=20260909-account-controls"></script>
<script type="module" src="/script.js?v=20260921-reasoning-capability"></script>
<script type="module" src="/app/workspaceNavigation.js?v=20260909-account-controls"></script>
</body>
</html>
+1 -1
View File
@@ -1,6 +1,6 @@
import {del, get, post, put, stream} from "./app/api.js?v=20260909-account-controls";
import {appendSources, createWebSearchToggle} from "./app/webSearch.js";
import {createReasoningToggle, finishReasoning, updateReasoning} from "./app/reasoning.js";
import {createReasoningToggle, finishReasoning, updateReasoning} from "./app/reasoning.js?v=20260921-reasoning-capability";
import {closeChatDrawer, openChatDrawer} from "./app/chatDrawer.js?v=20260909-account-controls";
import {onboardingPrompts, requestedChatId} from "./app/constants.js?v=20260909-account-controls";
import {getModelProfile} from "./app/modelProfiles.js?v=20260909-account-controls";