fix concurrent issue

Operations that change non-concurrent collections must have exclusive access
This commit is contained in:
Jack 2025-07-21 14:38:54 +08:00 committed by GitHub
parent efe4d9fea7
commit c59216659b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -17,13 +17,14 @@ public partial class AgentService
instructions.AddRange(secondaryInstructions);
// update states
var renderDict = new Dictionary<string, object>(agent.TemplateDict);
foreach (var t in conv.States.GetStates())
{
agent.TemplateDict[t.Key] = t.Value;
renderDict[t.Key] = t.Value;
}
agent.TemplateDict[TemplateRenderConstant.RENDER_AGENT] = agent;
var res = render.Render(string.Join("\r\n", instructions), agent.TemplateDict);
renderDict[TemplateRenderConstant.RENDER_AGENT] = agent;
var res = render.Render(string.Join("\r\n", instructions), renderDict);
return res;
}
@ -143,4 +144,4 @@ public partial class AgentService
return result.IsEqualTo("visible");
}
}
}