From 53821d12d7fbeda2e70a00312d2d0fa8bcd8e75e Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Wed, 17 Jul 2024 22:00:00 -0500 Subject: [PATCH] refine handle email request prompt --- .../Functions/HandleEmailRequestFn.cs | 4 ++-- .../functions/handle_email_request.json | 4 ++-- .../templates/handle_email_request.fn.liquid | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Plugins/BotSharp.Plugin.EmailHandler/Functions/HandleEmailRequestFn.cs b/src/Plugins/BotSharp.Plugin.EmailHandler/Functions/HandleEmailRequestFn.cs index 388860c1..458ac009 100644 --- a/src/Plugins/BotSharp.Plugin.EmailHandler/Functions/HandleEmailRequestFn.cs +++ b/src/Plugins/BotSharp.Plugin.EmailHandler/Functions/HandleEmailRequestFn.cs @@ -56,7 +56,7 @@ public class HandleEmailRequestFn : IFunctionCallback } mailMessage.Body = bodyBuilder.ToMessageBody(); - var response = await HandleSendEmailBySMTP(mailMessage); + var response = await SendEmailBySMTP(mailMessage); message.Content = response; _logger.LogWarning($"Email successfully send over to {recipient}. Email Subject: {subject} [{response}]"); @@ -140,7 +140,7 @@ public class HandleEmailRequestFn : IFunctionCallback } } - private async Task HandleSendEmailBySMTP(MimeMessage mailMessage) + private async Task SendEmailBySMTP(MimeMessage mailMessage) { using var smtpClient = new SmtpClient(); await smtpClient.ConnectAsync(_emailSettings.SMTPServer, _emailSettings.SMTPPort, SecureSocketOptions.StartTls); diff --git a/src/Plugins/BotSharp.Plugin.EmailHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/handle_email_request.json b/src/Plugins/BotSharp.Plugin.EmailHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/handle_email_request.json index 5aaef8d0..a8a79998 100644 --- a/src/Plugins/BotSharp.Plugin.EmailHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/handle_email_request.json +++ b/src/Plugins/BotSharp.Plugin.EmailHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/functions/handle_email_request.json @@ -1,6 +1,6 @@ { "name": "handle_email_request", - "description": "If the user requests to send an email, you need to capture the email content and the recipient email address. If the user explicitly enter email subject use the same if not intelligently capture the email subject from the content. Then call this function to send out email.", + "description": "If the user requests to send an email with or without attachments or files, you need to capture the email content and the recipient email address. If the user explicitly enter email subject use the same if not intelligently capture the email subject from the content. Then call this function to send out email.", "parameters": { "type": "object", "properties": { @@ -18,7 +18,7 @@ }, "is_need_attachments": { "type": "boolean", - "description": "If the user request to send email with attachemnt(s), then this value should be true. Otherwise, this value should be false." + "description": "If the user request to send email with attachemnt(s) or file(s), then this value should be True. Otherwise, this value should be False." } }, "required": [ "to_address", "email_content", "subject", "is_need_attachments" ] diff --git a/src/Plugins/BotSharp.Plugin.EmailHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/handle_email_request.fn.liquid b/src/Plugins/BotSharp.Plugin.EmailHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/handle_email_request.fn.liquid index 72c8da30..01163ab5 100644 --- a/src/Plugins/BotSharp.Plugin.EmailHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/handle_email_request.fn.liquid +++ b/src/Plugins/BotSharp.Plugin.EmailHandler/data/agents/6745151e-6d46-4a02-8de4-1c4f21c7da95/templates/handle_email_request.fn.liquid @@ -1,2 +1 @@ -Suppose user has uploaded some attachments. Please call handle_email_request if user wants to send out an email. \ No newline at end of file