Skip to content

Commit 10c0714

Browse files
author
Jicheng Lu
committed
refine
1 parent 35c44ac commit 10c0714

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/Infrastructure/BotSharp.Core/Agents/Services/AgentService.GetAgents.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ private void AddDefaultInstruction(Agent agent, string instruction)
132132
}
133133
}
134134

135-
return template;
135+
return template.DeepClone();
136136
}
137137

138138
public async Task InheritAgent(Agent agent)

src/Infrastructure/BotSharp.Core/Instructs/Services/InstructService.Instruct.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private async Task<Agent> BuildInnerAgent(InstructOptions? options)
6666

6767
if (!string.IsNullOrWhiteSpace(options?.TemplateName))
6868
{
69-
var template = agent?.Templates?.FirstOrDefault(x => x.Name == options.TemplateName);
69+
var template = agent?.Templates?.FirstOrDefault(x => x.Name.IsEqualTo(options.TemplateName));
7070
instruction = BuildInstruction(template?.Content ?? string.Empty, options?.Data ?? []);
7171
var templateLlmConfig = template?.LlmConfig;
7272
if (templateLlmConfig?.IsValid == true)

src/Plugins/BotSharp.Plugin.MongoStorage/Repository/MongoRepository.Agent.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ public async Task<bool> PatchAgentTemplate(string agentId, AgentTemplate templat
592592
}
593593

594594
foundTemplate.Content = template.Content;
595+
foundTemplate.ResponseFormat = template.ResponseFormat;
596+
foundTemplate.LlmConfig = AgentTemplateLlmConfigMongoModel.ToMongoModel(template.LlmConfig);
595597
var update = Builders<AgentDocument>.Update.Set(x => x.Templates, agent.Templates);
596598
await _dc.Agents.UpdateOneAsync(filter, update);
597599
return true;

0 commit comments

Comments
 (0)