Merge pull request #202 from hchen2020/master
Fix rich content text in InstructExecutor.
This commit is contained in:
commit
cbd76c4e8a
|
|
@ -101,6 +101,14 @@ public partial class ConversationService
|
||||||
_logger.LogInformation(text);
|
_logger.LogInformation(text);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Process rich content
|
||||||
|
if (response.RichContent != null &&
|
||||||
|
response.RichContent is RichContent<IMessageTemplate> template &&
|
||||||
|
string.IsNullOrEmpty(template.Message.Text))
|
||||||
|
{
|
||||||
|
template.Message.Text = response.Content;
|
||||||
|
}
|
||||||
|
|
||||||
// Only read content from RichContent for UI rendering. When richContent is null, create a basic text message for richContent.
|
// Only read content from RichContent for UI rendering. When richContent is null, create a basic text message for richContent.
|
||||||
var state = _services.GetRequiredService<IConversationStateService>();
|
var state = _services.GetRequiredService<IConversationStateService>();
|
||||||
response.RichContent = response.RichContent ?? new RichContent<IMessageTemplate>
|
response.RichContent = response.RichContent ?? new RichContent<IMessageTemplate>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
using BotSharp.Abstraction.Functions.Models;
|
using BotSharp.Abstraction.Functions.Models;
|
||||||
using BotSharp.Abstraction.Messaging.Models;
|
|
||||||
using BotSharp.Abstraction.Messaging.Models.RichContent;
|
|
||||||
using BotSharp.Abstraction.Planning;
|
using BotSharp.Abstraction.Planning;
|
||||||
using BotSharp.Abstraction.Routing;
|
using BotSharp.Abstraction.Routing;
|
||||||
|
|
||||||
|
|
@ -35,14 +33,6 @@ public class InstructExecutor : IExecutor
|
||||||
response.MessageId = message.MessageId;
|
response.MessageId = message.MessageId;
|
||||||
response.Instruction = inst;
|
response.Instruction = inst;
|
||||||
|
|
||||||
// Process rich content
|
|
||||||
if (response.RichContent != null &&
|
|
||||||
response.RichContent is RichContent<IMessageTemplate> template &&
|
|
||||||
string.IsNullOrEmpty(template.Message.Text))
|
|
||||||
{
|
|
||||||
template.Message.Text = response.Content;
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue