.NET: Remove automatic messageId assignment to fix integration test (#1006)

* Remove automatic messageid asssignment to fix integration test

* Remove other overrides from ChatClientAgent as well.
This commit is contained in:
westey
2025-09-30 16:54:36 +01:00
committed by GitHub
Unverified
parent ff8b97cc72
commit 0c2891f351
@@ -145,8 +145,6 @@ public sealed class ChatClientAgent : AIAgent
foreach (ChatMessage chatResponseMessage in chatResponse.Messages)
{
chatResponseMessage.AuthorName ??= agentName;
chatResponseMessage.MessageId ??= Guid.NewGuid().ToString("N");
chatResponseMessage.CreatedAt ??= DateTimeOffset.UtcNow;
}
// Only notify the thread of new messages if the chatResponse was successful to avoid inconsistent message state in the thread.
@@ -233,15 +231,12 @@ public sealed class ChatClientAgent : AIAgent
throw;
}
string? messageId = null;
while (hasUpdates)
{
var update = responseUpdatesEnumerator.Current;
if (update is not null)
{
update.AuthorName ??= this.Name;
update.CreatedAt ??= DateTimeOffset.UtcNow;
update.MessageId ??= (messageId ??= Guid.NewGuid().ToString("N"));
responseUpdates.Add(update);
yield return new(update) { AgentId = this.Id };