修复推理字段删除逻辑:当reasoning设置为off时正确删除原始请求中的推理字段
- 修正request-openai.js中reasoning字段的处理逻辑 - 修正request-anthropic.js中thinking字段的处理逻辑 - 确保当模型配置reasoning为off时,原始请求中的推理相关字段被显式删除 - 与routes.js中的直接转发逻辑保持一致
This commit is contained in:
@@ -120,23 +120,10 @@ export function transformToAnthropic(openaiRequest) {
|
||||
type: 'enabled',
|
||||
budget_tokens: budgetTokens[reasoningLevel]
|
||||
};
|
||||
}
|
||||
// If request already has thinking field, respect the configuration rule
|
||||
// Remove it if model config is off/invalid, otherwise override with config
|
||||
if (openaiRequest.thinking) {
|
||||
if (reasoningLevel) {
|
||||
const budgetTokens = {
|
||||
'low': 4096,
|
||||
'medium': 12288,
|
||||
'high': 24576
|
||||
};
|
||||
|
||||
anthropicRequest.thinking = {
|
||||
type: 'enabled',
|
||||
budget_tokens: budgetTokens[reasoningLevel]
|
||||
};
|
||||
}
|
||||
// If reasoningLevel is null (off/invalid), don't add thinking field
|
||||
} else {
|
||||
// If reasoning is off or invalid, explicitly remove thinking field
|
||||
// This ensures any thinking field from the original request is deleted
|
||||
delete anthropicRequest.thinking;
|
||||
}
|
||||
|
||||
// Pass through other compatible parameters
|
||||
|
||||
Reference in New Issue
Block a user