Skip to content

Commit 1376326

Browse files
author
Jicheng Lu
committed
add update all agent fields in file repository
1 parent e6e0192 commit 1376326

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Infrastructure/BotSharp.Core/Repository/FileRepository.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,17 @@ private void UpdateAgentAllFields(Agent inputAgent)
439439
var (agent, agentFile) = GetAgentFromFile(inputAgent.Id);
440440
if (agent == null) return;
441441

442+
agent.Name = inputAgent.Name;
443+
agent.Description = inputAgent.Description;
444+
agent.IsPublic = inputAgent.IsPublic;
445+
agent.UpdatedDateTime = DateTime.UtcNow;
446+
var json = JsonSerializer.Serialize(agent, _options);
447+
File.WriteAllText(agentFile, json);
442448

449+
UpdateAgentInstruction(inputAgent.Id, inputAgent.Instruction);
450+
UpdateAgentResponses(inputAgent.Id, inputAgent.Responses);
451+
UpdateAgentTemplates(inputAgent.Id, inputAgent.Templates);
452+
UpdateAgentFunctions(inputAgent.Id, inputAgent.Functions);
443453
}
444454
#endregion
445455

0 commit comments

Comments
 (0)