refactor: drop redundant max_input_tokens, default context fallback to 200K

max_input_tokens (180K) was only used to seed the context window before
context_config options overrode it. Every live CN model exposes selectable
contexts (200K/400K/1M) whose smallest option already exceeds 180K, so the
seed only ever acted as a redundant floor and was never the final value.

- updateQoderModelsCache: derive contextWindow from the largest
  context_config option directly; fall back to 200K when no context_config is
  present (was 180K via max_input_tokens).
- staticCnModels: the Auto entry (the no-context fallback) now uses 200K too,
  matching the dynamic fallback; its description no longer references the
  stale 180K live-catalog note.
This commit is contained in:
Loongphy
2026-08-28 10:11:37 +08:00
parent b462207447
commit cc461cd145
+10 -6
View File
@@ -260,9 +260,9 @@ export const staticCnModels: QoderModelDef[] = [
supportsEffort: false, supportsEffort: false,
input: ["text", "image"], input: ["text", "image"],
cost: ZERO_COST, cost: ZERO_COST,
contextWindow: 180000, contextWindow: 200000,
maxTokens: 32768, maxTokens: 32768,
description: "Qoder CN smart routing; live catalog reports 180K max input.", description: "Qoder CN smart routing; fallback context window of 200K.",
}, },
{ {
id: "Qwen3.7-Max", id: "Qwen3.7-Max",
@@ -497,13 +497,17 @@ export async function updateQoderModelsCache(
if (!key || !entry.enable) continue; if (!key || !entry.enable) continue;
const display = entry.display_name || key; const display = entry.display_name || key;
let ctxLen = entry.max_input_tokens || 180000; // The context window is the largest selectable context option the upstream
// catalog exposes (e.g. 1M when 200K/400K/1M are offered). Fall back to
// 200K when no context_config is present. `max_input_tokens` is not used:
// it is a flat base value (180K) that every catalog entry with selectable
// contexts already exceeds, so it only ever acted as a redundant floor.
let ctxLen = 200000;
if (entry.context_config && typeof entry.context_config === "object") { if (entry.context_config && typeof entry.context_config === "object") {
for (const configVal of Object.values(entry.context_config)) { for (const configVal of Object.values(entry.context_config)) {
if (configVal && typeof configVal === "object" && typeof configVal.token_count === "number") { if (configVal && typeof configVal === "object" && typeof configVal.token_count === "number") {
const tc = configVal.token_count; if (configVal.token_count > ctxLen) {
if (tc > ctxLen) { ctxLen = configVal.token_count;
ctxLen = tc;
} }
} }
} }