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
15 changes: 14 additions & 1 deletion src/Plugins/BotSharp.Plugin.KnowledgeBase/KnowledgeBasePlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class KnowledgeBasePlugin : IBotSharpPlugin
public string Name => "Knowledge Base";
public string Description => "Embedding private data and feed them into LLM in the conversation.";
public string IconUrl => "https://cdn-icons-png.flaticon.com/512/9592/9592995.png";
private string _membaseCredential = string.Empty;
private string _membaseProjectId = string.Empty;

public void RegisterDI(IServiceCollection services, IConfiguration config)
{
Expand All @@ -26,6 +28,9 @@ public void RegisterDI(IServiceCollection services, IConfiguration config)
services.AddScoped<IGraphKnowledgeService, GraphKnowledgeService>();
services.AddScoped<IKnowledgeHook, KnowledgeHook>();
services.AddScoped<IKnowledgeProcessor, TextFileKnowledgeProcessor>();

_membaseCredential = config.GetValue<string>("Membase:ApiKey")!;
_membaseProjectId = config.GetValue<string>("Membase:ProjectId")!;
}

public bool AttachMenu(List<PluginMenuDef> menu)
Expand All @@ -37,7 +42,15 @@ public bool AttachMenu(List<PluginMenuDef> menu)
SubMenu = new List<PluginMenuDef>
{
new PluginMenuDef("Q & A", link: "page/knowledge-base/question-answer"),
new PluginMenuDef("Relationships", link: "page/knowledge-base/relationships"),
new PluginMenuDef("Relationships", link: "page/knowledge-base/relationships/membase")
{
EmbeddingInfo = new EmbeddingData
{
Source = "membase",
HtmlTag = "iframe",
Url = $"http://console.membase.dev/query-editor/{_membaseProjectId}?token={_membaseCredential}"
}
},
new PluginMenuDef("Documents", link: "page/knowledge-base/documents"),
new PluginMenuDef("Dictionary", link: "page/knowledge-base/dictionary")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ namespace BotSharp.Plugin.Membase.Settings;
public class MembaseSettings
{
public string Host { get; set; } = "localhost";
public string ProjectId { get; set; } = string.Empty;
public string ApiKey { get; set; } = string.Empty;
}
Loading