Skip to content

Commit 0bb98a1

Browse files
103048103048
authored andcommitted
code improvement
1 parent 6c6ff56 commit 0bb98a1

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

src/Plugins/BotSharp.Plugin.EmailHandler/BotSharp.Plugin.EmailHandler.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_email_reader.json" />
1515
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\functions\handle_email_sender.json" />
1616
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_email_sender.fn.liquid" />
17+
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_email_reader.fn.liquid" />
1718
<None Remove="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\select_attachment_prompt.liquid" />
1819
</ItemGroup>
1920

@@ -30,14 +31,16 @@
3031
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\select_attachment_prompt.liquid">
3132
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
3233
</Content>
34+
<Content Include="data\agents\6745151e-6d46-4a02-8de4-1c4f21c7da95\templates\handle_email_reader.fn.liquid">
35+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
36+
</Content>
3337
</ItemGroup>
3438

3539
<ItemGroup>
3640
<PackageReference Include="MailKit" Version="4.7.0" />
3741
</ItemGroup>
3842

3943
<ItemGroup>
40-
<ProjectReference Include="..\..\..\..\onebrain\BusinessCore\BusinessCore.csproj" />
4144
<ProjectReference Include="..\..\Infrastructure\BotSharp.Core\BotSharp.Core.csproj" />
4245
</ItemGroup>
4346

src/Plugins/BotSharp.Plugin.EmailHandler/Functions/HandleEmailReaderFn.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using BotSharp.Core.Infrastructures;
66
using BotSharp.Plugin.EmailHandler.Models;
77
using BotSharp.Plugin.EmailHandler.Providers;
8-
using BusinessCore.Utils;
98
using MailKit;
109
using MailKit.Net.Imap;
1110
using MailKit.Search;
@@ -85,7 +84,7 @@ public async Task<bool> Execute(RoleDialogModel message)
8584
var response = await completion.GetChatCompletions(agent, dialogs);
8685
var content = response?.Content ?? string.Empty;
8786
message.Content = content;
88-
message.RichContent = BuildRichContent.TextPostBackRichContent(_state.GetConversationId(), message.Content);
87+
message.RichContent = BuildRichContentForSummary(_state.GetConversationId(), message.Content);
8988
return true;
9089
}
9190
UniqueId.TryParse(messageId, out UniqueId uid);
@@ -105,6 +104,19 @@ public async Task<bool> Execute(RoleDialogModel message)
105104
return false;
106105
}
107106
}
107+
public RichContent<IRichMessage> BuildRichContentForSummary(string conversationId, string content, string editorType = EditorTypeEnum.Text)
108+
{
109+
return new RichContent<IRichMessage>()
110+
{
111+
FillPostback = true,
112+
Editor = editorType,
113+
Recipient = new Recipient() { Id = conversationId },
114+
Message = new ButtonTemplateMessage()
115+
{
116+
Text = content,
117+
}
118+
};
119+
}
108120
private RichContent<IRichMessage> BuildRichContentForSubject(List<EmailModel> emailSubjects)
109121
{
110122
var text = "Please let me know which message I need to read?";

0 commit comments

Comments
 (0)