code improvement
This commit is contained in:
parent
6c6ff566a5
commit
0bb98a19e5
|
|
@ -14,6 +14,7 @@
|
|||
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_email_reader.json" />
|
||||
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_email_sender.json" />
|
||||
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_email_sender.fn.liquid" />
|
||||
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_email_reader.fn.liquid" />
|
||||
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\select_attachment_prompt.liquid" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
@ -30,6 +31,9 @@
|
|||
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\select_attachment_prompt.liquid">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_email_reader.fn.liquid">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
@ -37,7 +41,6 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\onebrain\BusinessCore\BusinessCore.csproj" />
|
||||
<ProjectReference Include="..\..\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using BotSharp.Abstraction.MLTasks;
|
|||
using BotSharp.Core.Infrastructures;
|
||||
using BotSharp.Plugin.EmailHandler.Models;
|
||||
using BotSharp.Plugin.EmailHandler.Providers;
|
||||
using BusinessCore.Utils;
|
||||
using MailKit;
|
||||
using MailKit.Net.Imap;
|
||||
using MailKit.Search;
|
||||
|
|
@ -85,7 +84,7 @@ public class HandleEmailReaderFn : IFunctionCallback
|
|||
var response = await completion.GetChatCompletions(agent, dialogs);
|
||||
var content = response?.Content ?? string.Empty;
|
||||
message.Content = content;
|
||||
message.RichContent = BuildRichContent.TextPostBackRichContent(_state.GetConversationId(), message.Content);
|
||||
message.RichContent = BuildRichContentForSummary(_state.GetConversationId(), message.Content);
|
||||
return true;
|
||||
}
|
||||
UniqueId.TryParse(messageId, out UniqueId uid);
|
||||
|
|
@ -105,6 +104,19 @@ public class HandleEmailReaderFn : IFunctionCallback
|
|||
return false;
|
||||
}
|
||||
}
|
||||
public RichContent<IRichMessage> BuildRichContentForSummary(string conversationId, string content, string editorType = EditorTypeEnum.Text)
|
||||
{
|
||||
return new RichContent<IRichMessage>()
|
||||
{
|
||||
FillPostback = true,
|
||||
Editor = editorType,
|
||||
Recipient = new Recipient() { Id = conversationId },
|
||||
Message = new ButtonTemplateMessage()
|
||||
{
|
||||
Text = content,
|
||||
}
|
||||
};
|
||||
}
|
||||
private RichContent<IRichMessage> BuildRichContentForSubject(List<EmailModel> emailSubjects)
|
||||
{
|
||||
var text = "Please let me know which message I need to read?";
|
||||
|
|
|
|||
Loading…
Reference in a new issue