diff --git a/src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionDef.cs b/src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionDef.cs index 153fb473..d89620a9 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionDef.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Functions/Models/FunctionDef.cs @@ -4,6 +4,7 @@ public class FunctionDef { public string Name { get; set; } public string Description { get; set; } + public string? Impact { get; set; } public FunctionParametersDef Parameters { get; set; } = new FunctionParametersDef(); public override string ToString() diff --git a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs index 8f3a865e..efcb9cf9 100644 --- a/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs +++ b/src/Infrastructure/BotSharp.Core/Conversations/Services/ConversationService.cs @@ -54,8 +54,6 @@ public partial class ConversationService : IConversationService public async Task NewConversation(Conversation sess) { var db = _services.GetRequiredService(); - var dbSettings = _services.GetRequiredService(); - var conversationSettings = _services.GetRequiredService(); var user = db.GetUserByExternalId(_user.Id); var foundUserId = user?.Id ?? string.Empty; diff --git a/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs b/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs index 4d862e7a..a1779c34 100644 --- a/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs +++ b/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs @@ -5,7 +5,6 @@ using BotSharp.Abstraction.Users.Models; using BotSharp.Abstraction.Agents.Models; using MongoDB.Driver; using BotSharp.Abstraction.Routing.Models; -using Amazon.Util; namespace BotSharp.Core.Repository; @@ -373,13 +372,7 @@ public class FileRepository : IBotSharpRepository var functionFile = Path.Combine(_dbSettings.FileRepository, _agentSettings.DataDir, agentId, "functions.json"); - var functions = new List(); - foreach (var function in inputFunctions) - { - functions.Add(JsonSerializer.Serialize(function, _options)); - } - - var functionText = JsonSerializer.Serialize(functions, _options); + var functionText = JsonSerializer.Serialize(inputFunctions, _options); File.WriteAllText(functionFile, functionText); } diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentResponseMongoElement.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentResponseMongoElement.cs index ee556549..26ddebbc 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentResponseMongoElement.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentResponseMongoElement.cs @@ -2,6 +2,7 @@ using BotSharp.Abstraction.Agents.Models; namespace BotSharp.Plugin.MongoStorage.Models; +[BsonIgnoreExtraElements] public class AgentResponseMongoElement { public string Prefix { get; set; } diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentTemplateMongoElement.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentTemplateMongoElement.cs index 719a11d9..847ec5c9 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentTemplateMongoElement.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/AgentTemplateMongoElement.cs @@ -2,6 +2,7 @@ using BotSharp.Abstraction.Agents.Models; namespace BotSharp.Plugin.MongoStorage.Models; +[BsonIgnoreExtraElements] public class AgentTemplateMongoElement { public string Name { get; set; } diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/FunctionDefMongoElement.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/FunctionDefMongoElement.cs index ec9699c0..5910661f 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/FunctionDefMongoElement.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/FunctionDefMongoElement.cs @@ -3,10 +3,12 @@ using System.Text.Json; namespace BotSharp.Plugin.MongoStorage.Models; +[BsonIgnoreExtraElements] public class FunctionDefMongoElement { public string Name { get; set; } public string Description { get; set; } + public string? Impact { get; set; } public FunctionParametersDefMongoElement Parameters { get; set; } = new FunctionParametersDefMongoElement(); public FunctionDefMongoElement() @@ -20,6 +22,7 @@ public class FunctionDefMongoElement { Name = function.Name, Description = function.Description, + Impact = function.Impact, Parameters = new FunctionParametersDefMongoElement { Type = function.Parameters.Type, @@ -35,6 +38,7 @@ public class FunctionDefMongoElement { Name = mongoFunction.Name, Description = mongoFunction.Description, + Impact = mongoFunction.Impact, Parameters = new FunctionParametersDef { Type = mongoFunction.Parameters.Type, diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/RoutingRuleMongoElement.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/RoutingRuleMongoElement.cs index 9f644c68..1a40b0f7 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Models/RoutingRuleMongoElement.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Models/RoutingRuleMongoElement.cs @@ -2,6 +2,7 @@ using BotSharp.Abstraction.Routing.Models; namespace BotSharp.Plugin.MongoStorage.Models; +[BsonIgnoreExtraElements] public class RoutingRuleMongoElement { public string Field { get; set; } diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Using.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Using.cs index 5debd75f..ca13f204 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Using.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Using.cs @@ -10,4 +10,5 @@ global using BotSharp.Abstraction.Plugins; global using Microsoft.Extensions.Configuration; global using Microsoft.Extensions.DependencyInjection; global using MongoDB.Bson; -global using MongoDB.Driver; \ No newline at end of file +global using MongoDB.Driver; +global using MongoDB.Bson.Serialization.Attributes; \ No newline at end of file