mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(qwen): preserve direct Token Plan constraints (#113976)
This commit is contained in:
committed by
GitHub
parent
aee5c0ae08
commit
c53ce6a76d
@@ -127,11 +127,6 @@ export const QWEN_TOKEN_PLAN_MODEL_CATALOG: ReadonlyArray<ModelDefinitionConfig>
|
||||
},
|
||||
];
|
||||
|
||||
export function isQwenTokenPlanModelId(modelId: string): boolean {
|
||||
const normalized = modelId.trim().toLowerCase();
|
||||
return QWEN_TOKEN_PLAN_MODEL_CATALOG.some((model) => model.id.toLowerCase() === normalized);
|
||||
}
|
||||
|
||||
export const QWEN_MODEL_CATALOG: ReadonlyArray<ModelDefinitionConfig> = [
|
||||
{
|
||||
id: "qwen3.5-plus",
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
isQwenTokenPlanDeepSeekV4ModelId,
|
||||
isQwenTokenPlanGlmModelId,
|
||||
isQwenTokenPlanKimiModelId,
|
||||
isQwenTokenPlanModelId,
|
||||
isQwenTokenPlanThinkingOnlyModelId,
|
||||
QWEN_TOKEN_PLAN_LEGACY_PROVIDER_ID,
|
||||
QWEN_TOKEN_PLAN_PROVIDER_ID,
|
||||
@@ -404,9 +403,11 @@ export function wrapQwenProviderStream(ctx: ProviderWrapStreamFnContext): Stream
|
||||
? undefined
|
||||
: resolveQwenTokenPlanThinkingContract(ctx.provider, ctx.modelId);
|
||||
const tokenPlanProvider = isQwenTokenPlanProviderId(ctx.provider);
|
||||
const tokenPlanModel =
|
||||
tokenPlanProvider && isQwenTokenPlanModelId(ctx.modelId) && !explicitLegacyThinkingFormat;
|
||||
const forceThinking = tokenPlanModel && isQwenTokenPlanThinkingOnlyModelId(ctx.modelId);
|
||||
// The picker catalog is intentionally curated; direct Token Plan refs still
|
||||
// need provider constraints unless an explicit transport format owns them.
|
||||
const useTokenPlanConstraints =
|
||||
tokenPlanProvider && !explicitLegacyThinkingFormat && thinkingFormat === undefined;
|
||||
const forceThinking = useTokenPlanConstraints && isQwenTokenPlanThinkingOnlyModelId(ctx.modelId);
|
||||
let streamFn = createQwenThinkingWrapper(
|
||||
ctx.streamFn,
|
||||
ctx.thinkingLevel,
|
||||
@@ -414,7 +415,7 @@ export function wrapQwenProviderStream(ctx: ProviderWrapStreamFnContext): Stream
|
||||
forceThinking,
|
||||
tokenPlanContract,
|
||||
);
|
||||
if (tokenPlanModel) {
|
||||
if (useTokenPlanConstraints) {
|
||||
// Config and request extra_body hooks run outside plugin wrappers. Reapply
|
||||
// model wire constraints after those hooks so invalid fields cannot escape.
|
||||
streamFn = createQwenTokenPlanConstraintWrapper(
|
||||
|
||||
Reference in New Issue
Block a user