From f2e0fb0ef7037578d5fd5bb0cd356538f098c4ad Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Mon, 4 Sep 2023 10:15:11 -0500 Subject: [PATCH] merge with dev --- .../BotSharp.Abstraction/Agents/Models/Agent.cs | 2 ++ .../BotSharp.Abstraction/Repositories/Records/AgentRecord.cs | 5 +++++ .../BotSharp.OpenAPI/ViewModels/Agents/AgentCreationModel.cs | 4 +++- .../BotSharp.OpenAPI/ViewModels/Agents/AgentViewModel.cs | 2 ++ .../Collections/AgentCollection.cs | 1 + .../Repository/MongoRepository.cs | 5 +++++ 6 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs b/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs index b9944764..ca11fb8d 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Agents/Models/Agent.cs @@ -33,6 +33,8 @@ public class Agent /// public string Knowledges { get; set; } + public bool IsPublic { get; set; } + public override string ToString() => $"{Name} {Id}"; diff --git a/src/Infrastructure/BotSharp.Abstraction/Repositories/Records/AgentRecord.cs b/src/Infrastructure/BotSharp.Abstraction/Repositories/Records/AgentRecord.cs index 224492c9..3a460218 100644 --- a/src/Infrastructure/BotSharp.Abstraction/Repositories/Records/AgentRecord.cs +++ b/src/Infrastructure/BotSharp.Abstraction/Repositories/Records/AgentRecord.cs @@ -16,6 +16,7 @@ public class AgentRecord : RecordBase public List Responses { get; set; } public string Samples { get; set; } + public bool IsPublic { get; set; } [Required] public DateTime CreatedTime { get; set; } @@ -32,6 +33,8 @@ public class AgentRecord : RecordBase Description = agent.Description, Instruction = agent.Instruction, Functions = agent.Functions, + Responses = agent.Responses, + IsPublic = agent.IsPublic }; } @@ -44,6 +47,8 @@ public class AgentRecord : RecordBase Description = Description, Instruction = Instruction, Functions = Functions, + Responses = Responses, + IsPublic = IsPublic, CreatedDateTime = CreatedTime, UpdatedDateTime = UpdatedTime }; diff --git a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentCreationModel.cs b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentCreationModel.cs index af66f5d1..34dac0b1 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentCreationModel.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentCreationModel.cs @@ -9,6 +9,7 @@ public class AgentCreationModel public string Instruction { get; set; } public List Functions { get; set; } public List Responses { get; set; } + public bool IsPublic { get; set; } public Agent ToAgent() { @@ -18,7 +19,8 @@ public class AgentCreationModel Description = Description, Instruction = Instruction, Functions = Functions, - Responses = Responses + Responses = Responses, + IsPublic = IsPublic }; } } diff --git a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentViewModel.cs b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentViewModel.cs index 1b68684c..fcf09026 100644 --- a/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentViewModel.cs +++ b/src/Infrastructure/BotSharp.OpenAPI/ViewModels/Agents/AgentViewModel.cs @@ -10,6 +10,7 @@ public class AgentViewModel public string Instruction { get; set; } public List Functions { get; set; } public List Responses { get; set; } + public bool IsPublic { get; set; } public DateTime UpdatedDateTime { get; set; } public static AgentViewModel FromAgent(Agent agent) @@ -22,6 +23,7 @@ public class AgentViewModel Instruction = agent.Instruction, Functions = agent.Functions, Responses = agent.Responses, + IsPublic= agent.IsPublic, UpdatedDateTime = agent.UpdatedDateTime }; } diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentCollection.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentCollection.cs index 617cad9c..3799af15 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentCollection.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Collections/AgentCollection.cs @@ -7,6 +7,7 @@ public class AgentCollection : MongoBase public string Instruction { get; set; } public List Functions { get; set; } public List Responses { get; set; } + public bool IsPublic { get; set; } public DateTime CreatedTime { get; set; } public DateTime UpdatedTime { get; set; } diff --git a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.cs b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.cs index 87d1611b..1e3ec3a1 100644 --- a/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.cs +++ b/src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.cs @@ -40,6 +40,7 @@ public class MongoRepository : IBotSharpRepository Instruction = x.Instruction, Functions = x.Functions, Responses = x.Responses, + IsPublic = x.IsPublic, CreatedTime = x.CreatedTime, UpdatedTime = x.UpdatedTime }).ToList(); @@ -243,6 +244,7 @@ public class MongoRepository : IBotSharpRepository Instruction = x.Instruction, Functions = x.Functions, Responses = x.Responses, + IsPublic = x.IsPublic, CreatedTime = x.CreatedTime, UpdatedTime = x.UpdatedTime }).ToList(); @@ -256,6 +258,7 @@ public class MongoRepository : IBotSharpRepository .Set(x => x.Instruction, agent.Instruction) .Set(x => x.Functions, agent.Functions) .Set(x => x.Responses, agent.Responses) + .Set(x => x.IsPublic, agent.IsPublic) .Set(x => x.CreatedTime, agent.CreatedTime) .Set(x => x.UpdatedTime, agent.UpdatedTime); _dc.Agents.UpdateOne(filter, update, _options); @@ -367,6 +370,7 @@ public class MongoRepository : IBotSharpRepository Instruction = agent.Instruction, Functions = agent.Functions, Responses = agent.Responses, + IsPublic = agent.IsPublic, UpdatedTime = DateTime.UtcNow }; @@ -378,6 +382,7 @@ public class MongoRepository : IBotSharpRepository .Set(x => x.Instruction, agent.Instruction) .Set(x => x.Functions, agent.Functions) .Set(x => x.Responses, agent.Responses) + .Set(x => x.IsPublic, agent.IsPublic) .Set(x => x.UpdatedTime, agent.UpdatedTime); _dc.Agents.UpdateOne(filter, update, _options);