mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-30 16:23:35 +08:00
Merge 40569113678856f321e5b5c3fb2743d00d31d331 into d1e684c419b4f88fee62490b0c2b4fcf65469e59
This commit is contained in:
commit
af00f7c8ce
@ -24,6 +24,17 @@ const TIERS = [
|
|||||||
},
|
},
|
||||||
] as const
|
] as const
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Strip [1m]/[2m] context-window suffixes so capability overrides match
|
||||||
|
* regardless of whether the runtime model name includes the suffix.
|
||||||
|
* The suffix is a client-side marker (never sent to the API) but the
|
||||||
|
* pinned env var may carry it, while the runtime model passed to
|
||||||
|
* modelSupportsThinking/modelSupportsEffort may not.
|
||||||
|
*/
|
||||||
|
function stripContextSuffix(model: string): string {
|
||||||
|
return model.replace(/\[(1|2)m\]/gi, '')
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether a 3p model capability override is set for a model that matches one of
|
* Check whether a 3p model capability override is set for a model that matches one of
|
||||||
* the pinned ANTHROPIC_DEFAULT_*_MODEL env vars.
|
* the pinned ANTHROPIC_DEFAULT_*_MODEL env vars.
|
||||||
@ -33,12 +44,12 @@ export const get3PModelCapabilityOverride = memoize(
|
|||||||
if (getAPIProvider() === 'firstParty' && isFirstPartyAnthropicBaseUrl()) {
|
if (getAPIProvider() === 'firstParty' && isFirstPartyAnthropicBaseUrl()) {
|
||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
const m = model.toLowerCase()
|
const m = stripContextSuffix(model.toLowerCase())
|
||||||
for (const tier of TIERS) {
|
for (const tier of TIERS) {
|
||||||
const pinned = process.env[tier.modelEnvVar]
|
const pinned = process.env[tier.modelEnvVar]
|
||||||
const capabilities = process.env[tier.capabilitiesEnvVar]
|
const capabilities = process.env[tier.capabilitiesEnvVar]
|
||||||
if (!pinned || capabilities === undefined) continue
|
if (!pinned || capabilities === undefined) continue
|
||||||
if (m !== pinned.toLowerCase()) continue
|
if (m !== stripContextSuffix(pinned.toLowerCase())) continue
|
||||||
return capabilities
|
return capabilities
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
.split(',')
|
.split(',')
|
||||||
@ -47,5 +58,5 @@ export const get3PModelCapabilityOverride = memoize(
|
|||||||
}
|
}
|
||||||
return undefined
|
return undefined
|
||||||
},
|
},
|
||||||
(model, capability) => `${model.toLowerCase()}:${capability}`,
|
(model, capability) => `${stripContextSuffix(model.toLowerCase())}:${capability}`,
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user