Fix GetAgents list.

This commit is contained in:
Haiping Chen 2023-10-23 12:41:44 -05:00
parent 758cfd556e
commit 7fb9440011
3 changed files with 4 additions and 4 deletions

View file

@ -7,7 +7,7 @@ public interface IAgentService
{ {
Task<Agent> CreateAgent(Agent agent); Task<Agent> CreateAgent(Agent agent);
Task RefreshAgents(); Task RefreshAgents();
Task<List<Agent>> GetAgents(); Task<List<Agent>> GetAgents(bool? allowRouting = null);
/// <summary> /// <summary>
/// Load agent configurations and trigger hooks /// Load agent configurations and trigger hooks

View file

@ -7,9 +7,9 @@ public partial class AgentService
#if !DEBUG #if !DEBUG
[MemoryCache(10 * 60)] [MemoryCache(10 * 60)]
#endif #endif
public async Task<List<Agent>> GetAgents() public async Task<List<Agent>> GetAgents(bool? allowRouting = null)
{ {
var agents = _db.GetAgentsByUser(_user.Id); var agents = _db.GetAgents(allowRouting: allowRouting);
return await Task.FromResult(agents); return await Task.FromResult(agents);
} }

View file

@ -137,7 +137,7 @@ public partial class RoutingService
private void FixMalformedResponse(FunctionCallFromLlm args) private void FixMalformedResponse(FunctionCallFromLlm args)
{ {
var agentService = _services.GetRequiredService<IAgentService>(); var agentService = _services.GetRequiredService<IAgentService>();
var agents = agentService.GetAgents().Result; var agents = agentService.GetAgents(allowRouting: true).Result;
var malformed = false; var malformed = false;
// Sometimes it populate malformed Function in Agent name // Sometimes it populate malformed Function in Agent name