From 1376326a7a388f798af35191d211337cd012de1d Mon Sep 17 00:00:00 2001 From: Jicheng Lu <103353@smsassist.com> Date: Fri, 15 Sep 2023 17:13:55 -0500 Subject: [PATCH] add update all agent fields in file repository --- .../BotSharp.Core/Repository/FileRepository.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs b/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs index 8b45a8f0..69d369e7 100644 --- a/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs +++ b/src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs @@ -439,7 +439,17 @@ public class FileRepository : IBotSharpRepository var (agent, agentFile) = GetAgentFromFile(inputAgent.Id); if (agent == null) return; + agent.Name = inputAgent.Name; + agent.Description = inputAgent.Description; + agent.IsPublic = inputAgent.IsPublic; + agent.UpdatedDateTime = DateTime.UtcNow; + var json = JsonSerializer.Serialize(agent, _options); + File.WriteAllText(agentFile, json); + UpdateAgentInstruction(inputAgent.Id, inputAgent.Instruction); + UpdateAgentResponses(inputAgent.Id, inputAgent.Responses); + UpdateAgentTemplates(inputAgent.Id, inputAgent.Templates); + UpdateAgentFunctions(inputAgent.Id, inputAgent.Functions); } #endregion