Skip to content

Commit bf89b87

Browse files
author
Tracy Boehrer
committed
Fix for 'EndOfStream does not trigger if QueueTextChunk has not been called'
1 parent 2d229c6 commit bf89b87

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libraries/Builder/Microsoft.Agents.Builder/StreamingResponse.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ public async Task EndStreamAsync(CancellationToken cancellationToken = default)
300300
}
301301
}
302302

303-
if (!string.IsNullOrEmpty(Message) || FinalMessage != null)
303+
if (UpdatesSent() > 0 || FinalMessage != null)
304304
{
305305
await SendActivityAsync(CreateFinalMessage(), cancellationToken).ConfigureAwait(false);
306306
}
@@ -312,7 +312,7 @@ private IActivity CreateFinalMessage()
312312
var activity = FinalMessage ?? new Activity();
313313

314314
activity.Type = ActivityTypes.Message;
315-
activity.Text = Message; // Teams won't allow Activity.Text changes
315+
activity.Text = !string.IsNullOrEmpty(Message) ? Message : "No text was streamed"; // Teams won't allow Activity.Text changes or empty text
316316
activity.Entities ??= [];
317317

318318
// make sure the supplied Activity doesn't have a streamInfo already.

0 commit comments

Comments
 (0)