fix(ai): enable temperature for Kimi models and default to 1.0

This commit is contained in:
t8y2 2026-06-19 11:36:29 +08:00
parent 0f1b5f8b53
commit dc90a80468
1 changed files with 3 additions and 2 deletions

View File

@ -436,12 +436,13 @@ fn is_kimi_model(model: &str) -> bool {
}
pub fn supports_temperature(config: &AiConfig) -> bool {
!(is_openai_api_config(config) && is_openai_reasoning_model(&config.model)) && !is_kimi_model(&config.model)
!(is_openai_api_config(config) && is_openai_reasoning_model(&config.model))
}
pub fn add_temperature_if_supported(body: &mut serde_json::Value, request: &AiCompletionRequest) {
if supports_temperature(&request.config) {
body["temperature"] = json!(request.temperature.unwrap_or(0.2));
let default_temp = if is_kimi_model(&request.config.model) { 1.0 } else { 0.2 };
body["temperature"] = json!(request.temperature.unwrap_or(default_temp));
}
}