commit
a5ba69c05c
|
|
@ -6,7 +6,6 @@ using BotSharp.Abstraction.Routing.Planning;
|
|||
using BotSharp.Abstraction.Settings;
|
||||
using BotSharp.Abstraction.Templating;
|
||||
using BotSharp.Core.Instructs;
|
||||
using BotSharp.Core.Knowledges.Services;
|
||||
using BotSharp.Core.Messaging;
|
||||
using BotSharp.Core.Routing.Planning;
|
||||
using BotSharp.Core.Templating;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
using BotSharp.Abstraction.Knowledges.Settings;
|
||||
using BotSharp.Abstraction.MLTasks;
|
||||
|
||||
namespace BotSharp.Core.Knowledges.Helpers;
|
||||
namespace BotSharp.Plugin.KnowledgeBase.Helpers;
|
||||
|
||||
public static class KnowledgeSettingHelper
|
||||
{
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
using BotSharp.Abstraction.Knowledges.Models;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace BotSharp.Core.Knowledges.Helpers;
|
||||
namespace BotSharp.Plugin.KnowledgeBase.Helpers;
|
||||
|
||||
public static class TextChopper
|
||||
{
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
using BotSharp.Abstraction.Plugins.Models;
|
||||
using BotSharp.Abstraction.Settings;
|
||||
using BotSharp.Core.Knowledges.Services;
|
||||
using BotSharp.Plugin.KnowledgeBase.Converters;
|
||||
using BotSharp.Plugin.KnowledgeBase.Hooks;
|
||||
using BotSharp.Plugin.KnowledgeBase.Services;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace BotSharp.Plugin.KnowledgeBase;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
using BotSharp.Abstraction.Knowledges.Models;
|
||||
using BotSharp.Abstraction.VectorStorage.Models;
|
||||
using BotSharp.Core.Knowledges.Helpers;
|
||||
|
||||
namespace BotSharp.Core.Knowledges.Services;
|
||||
namespace BotSharp.Plugin.KnowledgeBase.Services;
|
||||
|
||||
public partial class KnowledgeService
|
||||
{
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace BotSharp.Core.Knowledges.Services;
|
||||
namespace BotSharp.Plugin.KnowledgeBase.Services;
|
||||
|
||||
public partial class KnowledgeService
|
||||
{
|
||||
|
|
@ -1,8 +1,4 @@
|
|||
using BotSharp.Abstraction.Graph.Models;
|
||||
using BotSharp.Abstraction.Knowledges.Models;
|
||||
using BotSharp.Abstraction.VectorStorage.Models;
|
||||
|
||||
namespace BotSharp.Core.Knowledges.Services;
|
||||
namespace BotSharp.Plugin.KnowledgeBase.Services;
|
||||
|
||||
public partial class KnowledgeService
|
||||
{
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
using BotSharp.Abstraction.VectorStorage.Models;
|
||||
|
||||
namespace BotSharp.Core.Knowledges.Services;
|
||||
namespace BotSharp.Plugin.KnowledgeBase.Services;
|
||||
|
||||
public partial class KnowledgeService
|
||||
{
|
||||
|
|
@ -1,10 +1,4 @@
|
|||
using BotSharp.Abstraction.Graph;
|
||||
using BotSharp.Abstraction.Knowledges.Settings;
|
||||
using BotSharp.Abstraction.MLTasks;
|
||||
using BotSharp.Abstraction.VectorStorage;
|
||||
using BotSharp.Core.Knowledges.Helpers;
|
||||
|
||||
namespace BotSharp.Core.Knowledges.Services;
|
||||
namespace BotSharp.Plugin.KnowledgeBase.Services;
|
||||
|
||||
public partial class KnowledgeService : IKnowledgeService
|
||||
{
|
||||
|
|
@ -20,6 +20,7 @@ global using BotSharp.Abstraction.Knowledges.Settings;
|
|||
global using BotSharp.Abstraction.Knowledges.Enums;
|
||||
global using BotSharp.Abstraction.VectorStorage;
|
||||
global using BotSharp.Abstraction.VectorStorage.Models;
|
||||
global using BotSharp.Abstraction.Graph.Models;
|
||||
global using BotSharp.Abstraction.Knowledges.Models;
|
||||
global using BotSharp.Abstraction.MLTasks;
|
||||
global using BotSharp.Abstraction.Functions;
|
||||
|
|
|
|||
|
|
@ -36,22 +36,14 @@ public class GetTableDefinitionFn : IFunctionCallback
|
|||
{
|
||||
try
|
||||
{
|
||||
var sql = $"select * from information_schema.tables where table_name = @tableName";
|
||||
var escapedTableName = MySqlHelper.EscapeString(table);
|
||||
var sql = $"SHOW CREATE TABLE `{escapedTableName}`";
|
||||
|
||||
var result = connection.QueryFirstOrDefault(sql, new
|
||||
{
|
||||
tableName = escapedTableName
|
||||
});
|
||||
|
||||
if (result == null) continue;
|
||||
|
||||
sql = $"SHOW CREATE TABLE `{escapedTableName}`";
|
||||
using var command = new MySqlCommand(sql, connection);
|
||||
using var reader = command.ExecuteReader();
|
||||
if (reader.Read())
|
||||
{
|
||||
result = reader.GetString(1);
|
||||
var result = reader.GetString(1);
|
||||
tableDdls.Add(result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -91,13 +91,13 @@ public class DbKnowledgeService
|
|||
private string GetTableStructure(string table)
|
||||
{
|
||||
var settings = _services.GetRequiredService<SqlDriverSetting>();
|
||||
using var connection = new MySqlConnection(settings.MySqlConnectionString);
|
||||
connection.Open();
|
||||
|
||||
|
||||
var ddl = string.Empty;
|
||||
var escapedTableName = MySqlHelper.EscapeString(table);
|
||||
var sql = $"SHOW CREATE TABLE `{escapedTableName}`";
|
||||
|
||||
using var connection = new MySqlConnection(settings.MySqlConnectionString);
|
||||
connection.Open();
|
||||
using var command = new MySqlCommand(sql, connection);
|
||||
using var reader = command.ExecuteReader();
|
||||
if (reader.Read())
|
||||
|
|
|
|||
Loading…
Reference in a new issue