Skip to content

Commit f2ca026

Browse files
Relax stream cancellation filter after response start
Agent-Logs-Url: https://github.com/IntelliTect/EssentialCSharp.Web/sessions/c0627de3-aa52-4d77-a845-1420ecbe2416 Co-authored-by: BenjaminMichaelis <22186029+BenjaminMichaelis@users.noreply.github.com>
1 parent ae6bf10 commit f2ca026

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

EssentialCSharp.Web/Controllers/ChatController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public async Task StreamMessage([FromBody] ChatMessageRequest request, Cancellat
134134
await Response.WriteAsync("data: [DONE]\n\n", cancellationToken);
135135
await Response.Body.FlushAsync(cancellationToken);
136136
}
137-
catch (OperationCanceledException) when (cancellationToken.IsCancellationRequested || HttpContext.RequestAborted.IsCancellationRequested)
137+
catch (OperationCanceledException) when (Response.HasStarted || cancellationToken.IsCancellationRequested || HttpContext.RequestAborted.IsCancellationRequested)
138138
{
139139
LogChatStreamCancelled(_Logger, User.Identity?.Name);
140140
}

0 commit comments

Comments
 (0)