Skip to content

Commit a5ba69c

Browse files
authored
Merge pull request #625 from iceljc/master
relocate
2 parents afdd9d7 + b9a06bd commit a5ba69c

File tree

12 files changed

+14
-42
lines changed

12 files changed

+14
-42
lines changed

src/Infrastructure/BotSharp.Core/Conversations/ConversationPlugin.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using BotSharp.Abstraction.Settings;
77
using BotSharp.Abstraction.Templating;
88
using BotSharp.Core.Instructs;
9-
using BotSharp.Core.Knowledges.Services;
109
using BotSharp.Core.Messaging;
1110
using BotSharp.Core.Routing.Planning;
1211
using BotSharp.Core.Templating;

src/Infrastructure/BotSharp.Core/Knowledges/Helpers/KnowledgeSettingHelper.cs renamed to src/Plugins/BotSharp.Plugin.KnowledgeBase/Helpers/KnowledgeSettingHelper.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
using BotSharp.Abstraction.Knowledges.Settings;
2-
using BotSharp.Abstraction.MLTasks;
3-
4-
namespace BotSharp.Core.Knowledges.Helpers;
1+
namespace BotSharp.Plugin.KnowledgeBase.Helpers;
52

63
public static class KnowledgeSettingHelper
74
{

src/Infrastructure/BotSharp.Core/Knowledges/Helpers/TextChopper.cs renamed to src/Plugins/BotSharp.Plugin.KnowledgeBase/Helpers/TextChopper.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
using BotSharp.Abstraction.Knowledges.Models;
21
using System.Text.RegularExpressions;
32

4-
namespace BotSharp.Core.Knowledges.Helpers;
3+
namespace BotSharp.Plugin.KnowledgeBase.Helpers;
54

65
public static class TextChopper
76
{

src/Plugins/BotSharp.Plugin.KnowledgeBase/KnowledgeBasePlugin.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
using BotSharp.Abstraction.Plugins.Models;
22
using BotSharp.Abstraction.Settings;
3-
using BotSharp.Core.Knowledges.Services;
43
using BotSharp.Plugin.KnowledgeBase.Converters;
54
using BotSharp.Plugin.KnowledgeBase.Hooks;
5+
using BotSharp.Plugin.KnowledgeBase.Services;
66
using Microsoft.Extensions.Configuration;
77

88
namespace BotSharp.Plugin.KnowledgeBase;

src/Infrastructure/BotSharp.Core/Knowledges/Services/KnowledgeService.Create.cs renamed to src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Create.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using BotSharp.Abstraction.Knowledges.Models;
2-
using BotSharp.Abstraction.VectorStorage.Models;
3-
using BotSharp.Core.Knowledges.Helpers;
4-
5-
namespace BotSharp.Core.Knowledges.Services;
1+
namespace BotSharp.Plugin.KnowledgeBase.Services;
62

73
public partial class KnowledgeService
84
{

src/Infrastructure/BotSharp.Core/Knowledges/Services/KnowledgeService.Delete.cs renamed to src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Delete.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace BotSharp.Core.Knowledges.Services;
1+
namespace BotSharp.Plugin.KnowledgeBase.Services;
22

33
public partial class KnowledgeService
44
{

src/Infrastructure/BotSharp.Core/Knowledges/Services/KnowledgeService.Get.cs renamed to src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Get.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using BotSharp.Abstraction.Graph.Models;
2-
using BotSharp.Abstraction.Knowledges.Models;
3-
using BotSharp.Abstraction.VectorStorage.Models;
4-
5-
namespace BotSharp.Core.Knowledges.Services;
1+
namespace BotSharp.Plugin.KnowledgeBase.Services;
62

73
public partial class KnowledgeService
84
{

src/Infrastructure/BotSharp.Core/Knowledges/Services/KnowledgeService.Update.cs renamed to src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.Update.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using BotSharp.Abstraction.VectorStorage.Models;
2-
3-
namespace BotSharp.Core.Knowledges.Services;
1+
namespace BotSharp.Plugin.KnowledgeBase.Services;
42

53
public partial class KnowledgeService
64
{

src/Infrastructure/BotSharp.Core/Knowledges/Services/KnowledgeService.cs renamed to src/Plugins/BotSharp.Plugin.KnowledgeBase/Services/KnowledgeService.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
using BotSharp.Abstraction.Graph;
2-
using BotSharp.Abstraction.Knowledges.Settings;
3-
using BotSharp.Abstraction.MLTasks;
4-
using BotSharp.Abstraction.VectorStorage;
5-
using BotSharp.Core.Knowledges.Helpers;
6-
7-
namespace BotSharp.Core.Knowledges.Services;
1+
namespace BotSharp.Plugin.KnowledgeBase.Services;
82

93
public partial class KnowledgeService : IKnowledgeService
104
{

src/Plugins/BotSharp.Plugin.KnowledgeBase/Using.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
global using BotSharp.Abstraction.Knowledges.Enums;
2121
global using BotSharp.Abstraction.VectorStorage;
2222
global using BotSharp.Abstraction.VectorStorage.Models;
23+
global using BotSharp.Abstraction.Graph.Models;
2324
global using BotSharp.Abstraction.Knowledges.Models;
2425
global using BotSharp.Abstraction.MLTasks;
2526
global using BotSharp.Abstraction.Functions;

src/Plugins/BotSharp.Plugin.SqlDriver/Functions/GetTableDefinitionFn.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,22 +36,14 @@ public async Task<bool> Execute(RoleDialogModel message)
3636
{
3737
try
3838
{
39-
var sql = $"select * from information_schema.tables where table_name = @tableName";
4039
var escapedTableName = MySqlHelper.EscapeString(table);
40+
var sql = $"SHOW CREATE TABLE `{escapedTableName}`";
4141

42-
var result = connection.QueryFirstOrDefault(sql, new
43-
{
44-
tableName = escapedTableName
45-
});
46-
47-
if (result == null) continue;
48-
49-
sql = $"SHOW CREATE TABLE `{escapedTableName}`";
5042
using var command = new MySqlCommand(sql, connection);
5143
using var reader = command.ExecuteReader();
5244
if (reader.Read())
5345
{
54-
result = reader.GetString(1);
46+
var result = reader.GetString(1);
5547
tableDdls.Add(result);
5648
}
5749

src/Plugins/BotSharp.Plugin.SqlDriver/Services/DbKnowledgeService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ public async Task<bool> Import(string provider, string model, string schema)
9191
private string GetTableStructure(string table)
9292
{
9393
var settings = _services.GetRequiredService<SqlDriverSetting>();
94-
using var connection = new MySqlConnection(settings.MySqlConnectionString);
95-
connection.Open();
96-
94+
9795
var ddl = string.Empty;
9896
var escapedTableName = MySqlHelper.EscapeString(table);
9997
var sql = $"SHOW CREATE TABLE `{escapedTableName}`";
10098

99+
using var connection = new MySqlConnection(settings.MySqlConnectionString);
100+
connection.Open();
101101
using var command = new MySqlCommand(sql, connection);
102102
using var reader = command.ExecuteReader();
103103
if (reader.Read())

0 commit comments

Comments
 (0)