diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.Summary.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.Summary.cs index f5c7d76c..a34a2793 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.Summary.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.Summary.cs @@ -97,7 +97,12 @@ public partial class ConversationService foreach (var dialog in dialogs.TakeLast(maxDialogCount)) { var role = dialog.Role; - if (role != AgentRole.User && role != AgentRole.Assistant) continue; + if (role == AgentRole.Function) continue; + + if (role != AgentRole.User) + { + role = AgentRole.Assistant; + } conversation += $"{role}: {dialog.Payload ?? dialog.Content}\r\n"; } diff --git a/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs b/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs index c1ee7920..bc721eab 100644 --- a/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs +++ b/src/Infrastructure/BotSharp.Core/Users/Services/UserService.cs @@ -217,7 +217,7 @@ public class UserService : IUserService return user; } - [MemoryCache(10 * 60)] + [MemoryCache(10 * 60, perInstanceCache: true)] public async Task GetUser(string id) { var db = _services.GetRequiredService();