Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ public async Task<string> GetConversationSummary(IEnumerable<string> conversatio
contents.Add(content);
}

if (contents.IsNullOrEmpty()) return string.Empty;

var router = await agentService.LoadAgent(AIAssistant);
var prompt = GetPrompt(router, contents);
var summary = await Summarize(router, prompt);
Expand Down Expand Up @@ -97,7 +99,12 @@ private string GetConversationContent(List<RoleDialogModel> dialogs, int maxDial
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";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public async Task<User> GetMyProfile()
return user;
}

[MemoryCache(10 * 60)]
[MemoryCache(10 * 60, perInstanceCache: true)]
public async Task<User> GetUser(string id)
{
var db = _services.GetRequiredService<IBotSharpRepository>();
Expand Down