Skip to content

Commit c4c95b2

Browse files
committed
Merge branch 'shorten'
2 parents f762721 + 7360cc7 commit c4c95b2

2 files changed

Lines changed: 17 additions & 6 deletions

File tree

‎src/threecode/prompts.nim‎

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2762,18 +2762,23 @@ func matchesWireRepairCandidate*(comboModel, model: string): bool =
27622762
## `kimi-k3`). Endpoints occasionally list such ids without serving
27632763
## them on chat/completions, and the verification ping doesn't catch
27642764
## it (that gateway serves unknown ids too), so the wire-id repair
2765-
## rewrites them to the curated id. Only alias-shaped combos
2766-
## qualify (combo `k3`, whose normalized form is the alias expansion
2767-
## `kimi-k3`): the short ids where providers actually pull this
2768-
## trick. Dated and routing variants of ordinary combos
2765+
## rewrites them to the curated id. Only a numeric qualifier tail
2766+
## qualifies (`256k`): the listed-but-unserved ids providers actually
2767+
## pull this trick with. A non-numeric tail is a designator, a
2768+
## different model (`glm-5.3-flash` never collapses into `glm-5.3`).
2769+
## Dated and routing variants of ordinary combos
27692770
## (`gpt-5.5-pro`, `deepseek-v4-flash-20260731`) stay experimental
27702771
## by design. Used only by `knownGoodWireModel`: the experimental
27712772
## gate and the curated defaults (`isKnownGood`, `knownGoodFamily`,
27722773
## `knownGoodReasonings`) deliberately keep the narrower matching.
27732774
if matchesKnownGoodModel(comboModel, model): return true
2775+
# The normalized combo must be the full normalized model plus one
2776+
# qualifier tail: `kimi-k3` + `256k` repairs, but `glm-5.3` +
2777+
# `flash` is a different designator, a different model.
27742778
let normCombo = normalizeModelName(comboModel)
2775-
if normCombo != aliasExpansion(comboModel): return false
2776-
aliasExpansion(model).startsWith(normCombo & "-")
2779+
if not normalizeModelName(model).startsWith(normCombo & "-"): return false
2780+
let tail = normalizeModelName(model)[normCombo.len + 1 .. ^1]
2781+
tail.split('-').allIt(it.len > 0 and it[0] in {'0'..'9'})
27772782

27782783
proc canonicalKnownGoodProvider*(provider: string): string =
27792784
## Map config provider names onto the KnownGoodCombos provider key.

‎tests/config/test_config_extra.nim‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,12 @@ suite "config: known-good lookup with normalized pretty names":
241241
# Distinct models and unknown ids are not rewritten.
242242
check knownGoodWireModel("kimicode", "kimi-k2.6") == ""
243243
check knownGoodWireModel("kimicode", "weird-model") == ""
244+
# A designator sibling is not a qualifier tail of the base combo.
245+
check knownGoodWireModel("zai", "glm-5.3-flash") == "glm-5.3-flash"
246+
check knownGoodWireModel("zai", "glm-5.3") == "glm-5.3"
247+
check knownGoodWireModel("openrouter", "z-ai/glm-5.3-flash") == "z-ai/glm-5.3-flash"
248+
check knownGoodWireModel("novita", "glm-5.3-flash") == "zai-org/glm-5.3-flash"
249+
check knownGoodWireModel("venice", "glm-5.3-flash") == "z-ai-glm-5-3-flash"
244250

245251
test "orderedModels ranks normalized known-good models first":
246252
let prov = ProviderRec(name: "zai", url: "https://api.z.ai",

0 commit comments

Comments
 (0)