fix: handle both reasoning_content and reasoning fields for NVIDIA API
All checks were successful
BotServer CI/CD / build (push) Successful in 3m12s

This commit is contained in:
Rodrigo Rodriguez (Pragmatismo) 2026-04-13 16:21:05 -03:00
parent 8ddcde4830
commit 60fd3dbbc4

View file

@ -463,7 +463,9 @@ impl LLMProvider for OpenAIClient {
if line.starts_with("data: ") && !line.contains("[DONE]") { if line.starts_with("data: ") && !line.contains("[DONE]") {
if let Ok(data) = serde_json::from_str::<Value>(&line[6..]) { if let Ok(data) = serde_json::from_str::<Value>(&line[6..]) {
let content = data["choices"][0]["delta"]["content"].as_str(); let content = data["choices"][0]["delta"]["content"].as_str();
let reasoning = data["choices"][0]["delta"]["reasoning_content"].as_str(); // Handle both reasoning_content (GLM4.7) and reasoning (Kimi K2.5)
let reasoning = data["choices"][0]["delta"]["reasoning_content"].as_str()
.or_else(|| data["choices"][0]["delta"]["reasoning"].as_str());
// Detect reasoning phase (GLM4.7, Kimi K2.5) // Detect reasoning phase (GLM4.7, Kimi K2.5)
if reasoning.is_some() && content.is_none() { if reasoning.is_some() && content.is_none() {