Default RichContent

This commit is contained in:
Yanan Wang 2023-10-27 17:55:28 -05:00
parent e43b3e6fa1
commit 89c62bf496

View file

@ -1,4 +1,5 @@
using BotSharp.Abstraction.Agents.Models;
using BotSharp.Abstraction.Messaging.Models.RichContent;
using BotSharp.Abstraction.Routing;
using BotSharp.Abstraction.Routing.Settings;
using System.Drawing;
@ -100,6 +101,15 @@ public partial class ConversationService
_logger.LogInformation(text);
#endif
// Only read content from RichContent for UI rendering. When richContent is null, create a basic text message for richContent.
var state = _services.GetRequiredService<IConversationStateService>();
message.RichContent = message.RichContent ?? new RichContent<TextMessage>
{
Recipient = new Recipient { Id = state.GetConversationId() },
MessageingType = "RESPONSE",
Message = new TextMessage { Text = message.Content }
};
var hooks = _services.GetServices<IConversationHook>().ToList();
foreach (var hook in hooks)
{