2024-10-24 19:36:04 +00:00
|
|
|
using BotSharp.Abstraction.Agents.Enums;
|
2024-09-17 11:32:11 +00:00
|
|
|
using BotSharp.Abstraction.Planning;
|
|
|
|
|
|
2024-01-18 11:30:28 +00:00
|
|
|
namespace BotSharp.Plugin.SqlDriver;
|
2024-01-13 21:17:40 +00:00
|
|
|
|
2024-01-18 11:30:28 +00:00
|
|
|
public class SqlDriverPlugin : IBotSharpPlugin
|
2024-01-13 21:17:40 +00:00
|
|
|
{
|
2024-01-18 11:30:28 +00:00
|
|
|
public string Id => "da7b6f7a-b1f0-455a-9939-ad2d493e929e";
|
|
|
|
|
public string Name => "SQL Driver";
|
2024-02-19 22:55:41 +00:00
|
|
|
public string Description => "Convert the user requirements into corresponding SQL statements";
|
|
|
|
|
public string IconUrl => "https://uxwing.com/wp-content/themes/uxwing/download/file-and-folder-type/sql-icon.png";
|
2024-01-13 21:17:40 +00:00
|
|
|
|
2024-10-24 19:36:04 +00:00
|
|
|
public string[] AgentIds =
|
|
|
|
|
[
|
|
|
|
|
BuiltInAgentId.SqlDriver
|
|
|
|
|
];
|
|
|
|
|
|
2024-01-13 21:17:40 +00:00
|
|
|
public void RegisterDI(IServiceCollection services, IConfiguration config)
|
|
|
|
|
{
|
2024-02-19 22:55:41 +00:00
|
|
|
services.AddScoped(provider =>
|
2024-01-13 21:17:40 +00:00
|
|
|
{
|
2024-02-19 22:55:41 +00:00
|
|
|
var settingService = provider.GetRequiredService<ISettingService>();
|
|
|
|
|
return settingService.Bind<SqlDriverSetting>("SqlDriver");
|
2024-01-13 21:17:40 +00:00
|
|
|
});
|
2024-02-19 22:55:41 +00:00
|
|
|
|
|
|
|
|
services.AddScoped<SqlDriverService>();
|
2024-09-03 20:41:12 +00:00
|
|
|
services.AddScoped<DbKnowledgeService>();
|
2024-02-19 22:55:41 +00:00
|
|
|
services.AddScoped<IKnowledgeHook, SqlDriverKnowledgeHook>();
|
2024-07-15 20:06:22 +00:00
|
|
|
services.AddScoped<IAgentHook, SqlExecutorHook>();
|
2024-09-24 15:45:57 +00:00
|
|
|
services.AddScoped<IAgentUtilityHook, SqlUtilityHook>();
|
2024-09-17 11:32:11 +00:00
|
|
|
services.AddScoped<IPlanningHook, SqlDriverPlanningHook>();
|
2024-09-24 15:45:57 +00:00
|
|
|
services.AddScoped<IAgentHook, SqlDictionaryLookupHook>();
|
2024-09-30 20:14:37 +00:00
|
|
|
services.AddScoped<IAgentHook, GetTableDefinitionHook>();
|
2024-11-12 18:02:25 +00:00
|
|
|
services.AddScoped<IConversationHook, SqlDriverConversationHook>();
|
2024-01-13 21:17:40 +00:00
|
|
|
}
|
|
|
|
|
}
|