fix: 修复droid claude的temperature参数问题

This commit is contained in:
shaw
2025-10-12 19:14:25 +08:00
parent 0b00682e74
commit 33e69ac6e2

View File

@@ -1012,25 +1012,20 @@ class DroidRelayService {
if ('thinking' in processedBody) { if ('thinking' in processedBody) {
delete processedBody.thinking delete processedBody.thinking
} }
} else if ( } else if (processedBody.thinking && processedBody.thinking.type === 'enabled') {
processedBody.thinking && if (hasTemperatureField) {
processedBody.thinking.type === 'enabled' &&
hasTemperatureField
) {
const parsedTemperature = const parsedTemperature =
typeof processedBody.temperature === 'string' typeof processedBody.temperature === 'string'
? parseFloat(processedBody.temperature) ? parseFloat(processedBody.temperature)
: processedBody.temperature : processedBody.temperature
if (typeof parsedTemperature === 'number' && !Number.isNaN(parsedTemperature)) { if (typeof parsedTemperature !== 'number' || Number.isNaN(parsedTemperature)) {
if (parsedTemperature <= 0) {
// 当开启 thinking 时temperature 不允许为 0
processedBody.temperature = 1
}
} else {
delete processedBody.temperature delete processedBody.temperature
} }
} }
processedBody.temperature = 1
}
} }
// OpenAI 端点:处理 reasoning 字段 // OpenAI 端点:处理 reasoning 字段