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,24 +1012,19 @@ 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' && const parsedTemperature =
hasTemperatureField typeof processedBody.temperature === 'string'
) { ? parseFloat(processedBody.temperature)
const parsedTemperature = : processedBody.temperature
typeof processedBody.temperature === 'string'
? parseFloat(processedBody.temperature)
: processedBody.temperature
if (typeof parsedTemperature === 'number' && !Number.isNaN(parsedTemperature)) { if (typeof parsedTemperature !== 'number' || Number.isNaN(parsedTemperature)) {
if (parsedTemperature <= 0) { delete processedBody.temperature
// 当开启 thinking 时temperature 不允许为 0
processedBody.temperature = 1
} }
} else {
delete processedBody.temperature
} }
processedBody.temperature = 1
} }
} }