diff --git a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs index b2f246fb0..c00332c6a 100644 --- a/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs +++ b/src/Infrastructure/BotSharp.Core/Routing/RoutingService.InvokeAgent.cs @@ -38,13 +38,14 @@ public async Task InvokeAgent( RoleDialogModel response; var message = dialogs.Last(); + var conversationDialogs = dialogs.Where(x => x.MessageType != MessageTypeName.RecordOnly).ToList(); if (options?.UseStream == true) { - response = await chatCompletion.GetChatCompletionsStreamingAsync(agent, dialogs); + response = await chatCompletion.GetChatCompletionsStreamingAsync(agent, conversationDialogs); } else { - response = await chatCompletion.GetChatCompletions(agent, dialogs); + response = await chatCompletion.GetChatCompletions(agent, conversationDialogs); } if (response.Role == AgentRole.Function && !string.IsNullOrEmpty(response.FunctionName))