Fix CreateMessageRule.Role to be of type Role (#264)

This commit is contained in:
Stephen Toub 2025-04-10 10:51:41 -04:00 • committed by GitHub
commit 45dcfe07ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -142,7 +142,7 @@ public static class McpServerExtensions
ModelPreferences = modelPreferences,
}, cancellationToken).ConfigureAwait(false);
return new(new ChatMessage(new(result.Role), [result.Content.ToAIContent()]))
return new(new ChatMessage(result.Role is Role.User ? ChatRole.User : ChatRole.Assistant, [result.Content.ToAIContent()]))
{
ModelId = result.Model,
FinishReason = result.StopReason switch