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 @@ -22,6 +22,8 @@ public async Task<string> GetConversationSummary(IEnumerable<string> conversatio
if (dialogs.IsNullOrEmpty()) continue;

var content = GetConversationContent(dialogs);
if (string.IsNullOrEmpty(content)) continue;

contents.Add(content);
}

Expand Down Expand Up @@ -95,14 +97,16 @@ 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;
}
if (role != AgentRole.User && role != AgentRole.Assistant) continue;

conversation += $"{role}: {dialog.Payload ?? dialog.Content}\r\n";
}

if (string.IsNullOrEmpty(conversation))
{
return string.Empty;
}

return conversation + "\r\n";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public async Task<ConversationViewModel> NewConversation([FromRoute] string agen
{
AgentId = agentId,
Channel = ConversationChannel.OpenAPI,
UserId = _user.Id,
TaskId = config.TaskId
};
conv = await service.NewConversation(conv);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using BotSharp.Abstraction.Plugins.Models;
using BotSharp.Abstraction.Repositories.Enums;
using BotSharp.Abstraction.Users.Enums;
using BotSharp.Plugin.MongoStorage.Repository;

namespace BotSharp.Plugin.MongoStorage;
Expand Down Expand Up @@ -34,7 +35,10 @@ public void RegisterDI(IServiceCollection services, IConfiguration config)
public bool AttachMenu(List<PluginMenuDef> menu)
{
var section = menu.First(x => x.Label == "Apps");
menu.Add(new PluginMenuDef("MongoDB", icon: "bx bx-data", link: "page/mongodb", weight: section.Weight + 10));
menu.Add(new PluginMenuDef("MongoDB", icon: "bx bx-data", link: "page/mongodb", weight: section.Weight + 10)
{
Roles = new List<string> { UserRole.Admin }
});
return true;
}
}