fix user cache
This commit is contained in:
parent
b77e77e310
commit
c0cd2387a2
|
|
@ -97,7 +97,12 @@ public partial class ConversationService
|
||||||
foreach (var dialog in dialogs.TakeLast(maxDialogCount))
|
foreach (var dialog in dialogs.TakeLast(maxDialogCount))
|
||||||
{
|
{
|
||||||
var role = dialog.Role;
|
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";
|
conversation += $"{role}: {dialog.Payload ?? dialog.Content}\r\n";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -217,7 +217,7 @@ public class UserService : IUserService
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
[MemoryCache(10 * 60)]
|
[MemoryCache(10 * 60, perInstanceCache: true)]
|
||||||
public async Task<User> GetUser(string id)
|
public async Task<User> GetUser(string id)
|
||||||
{
|
{
|
||||||
var db = _services.GetRequiredService<IBotSharpRepository>();
|
var db = _services.GetRequiredService<IBotSharpRepository>();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue