diff --git a/src/Infrastructure/BotSharp.Abstraction/Agents/Settings/AgentSettings.cs b/src/Infrastructure/BotSharp.Abstraction/Agents/Settings/AgentSettings.cs index 9cc514bb..cc4be062 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Agents/Settings/AgentSettings.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Agents/Settings/AgentSettings.cs @@ -4,4 +4,10 @@ public class AgentSettings { public string DataDir { get; set; } = string.Empty; public string TemplateFormat { get; set; } = "liquid"; + + /// + /// This is the default LLM config for agent + /// + public AgentLlmConfig LlmConfig { get; set; } + = new AgentLlmConfig(); } diff --git a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs index e218e9b7..f38050f0 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs @@ -19,11 +19,12 @@ public partial class RoutingService } var agentService = _services.GetRequiredService(); + var agentSetting = _services.GetRequiredService(); var agent = await agentService.LoadAgent(agentId); var chatCompletion = CompletionProvider.GetChatCompletion(_services, - provider: agent?.LlmConfig?.Provider, - model: agent.LlmConfig?.Model); + provider: agent?.LlmConfig?.Provider ?? agentSetting.LlmConfig.Provider, + model: agent.LlmConfig?.Model ?? agentSetting.LlmConfig.Model); var message = dialogs.Last(); var response = chatCompletion.GetChatCompletions(agent, dialogs); diff --git a/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj b/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj index 99c35ca7..46896970 100644 --- a/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj +++ b/src/Plugins/BotSharp.Plugin.Twilio/BotSharp.Plugin.Twilio.csproj @@ -8,6 +8,7 @@ + diff --git a/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioEmailController.cs b/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioEmailController.cs new file mode 100644 index 00000000..819d0773 --- /dev/null +++ b/src/Plugins/BotSharp.Plugin.Twilio/Controllers/TwilioEmailController.cs @@ -0,0 +1,36 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using StrongGrid; + +namespace BotSharp.Plugin.Twilio.Controllers; + +[AllowAnonymous] +public class TwilioEmailController : ControllerBase +{ + private readonly TwilioSetting _settings; + private readonly IServiceProvider _services; + + public TwilioEmailController(TwilioSetting settings, IServiceProvider services) + { + _settings = settings; + _services = services; + } + + [HttpPost("/twilio/email")] + public async Task IncomingEmail() + { + // https://docs.sendgrid.com/api-reference/settings-inbound-parse/create-a-parse-setting + var parser = new WebhookParser(); + var inboundEmail = await parser.ParseInboundEmailWebhookAsync(Request.Body).ConfigureAwait(false); + + // ... do something with the inbound email ... + + return Ok(); + } +} + +public class SendGridWebhook +{ + public string From { get; set; } + public string To { get; set; } +} diff --git a/src/WebStarter/appsettings.json b/src/WebStarter/appsettings.json index 1558291a..0e9bbd5e 100644 --- a/src/WebStarter/appsettings.json +++ b/src/WebStarter/appsettings.json @@ -49,7 +49,11 @@ "Agent": { "DataDir": "agents", "TemplateFormat": "liquid", - "MaxRecursiveDepth": 3 + "MaxRecursiveDepth": 3, + "LlmConfig": { + "Provider": "azure-openai", + "Model": "one" + } }, "Conversation": { diff --git a/src/WebStarter/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/agent.json b/src/WebStarter/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/agent.json index 24cb1d76..a5e40a9f 100644 --- a/src/WebStarter/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/agent.json +++ b/src/WebStarter/data/agents/01fcc3e5-9af7-49e6-ad7a-a760bd12dc4a/agent.json @@ -7,6 +7,6 @@ "isPublic": true, "llmConfig": { "provider": "azure-openai", - "model": "gpt-35-turbo" + "model": "one" } } \ No newline at end of file