Update the streaming detection to work with Mistral

This commit is contained in:
Clément Renault 2025-05-16 15:17:01 +02:00 committed by Kerollmops
parent 116fbb4c24
commit afadfa420a
No known key found for this signature in database
GPG Key ID: F250A4C4E3AE5F5F

View File

@ -281,11 +281,14 @@ async fn streamed_chat(
// Using deprecated field but keeping for compatibility // Using deprecated field but keeping for compatibility
function_call: _, function_call: _,
ref tool_calls, ref tool_calls,
role: _, role,
refusal: _, refusal: _,
} = delta; } = delta;
if content.is_none() && tool_calls.is_none() && global_tool_calls.is_empty() if content.as_ref().map_or(true, |s| s.is_empty())
&& tool_calls.is_none()
&& global_tool_calls.is_empty()
&& role.is_none()
{ {
break 'main; break 'main;
} }