Skip to content

Commit 8d8fd75

Browse files
author
songguo.zeng
committed
AII-400
1 parent 7f6845b commit 8d8fd75

File tree

3 files changed

+1
-27
lines changed

3 files changed

+1
-27
lines changed

src/Infrastructure/BotSharp.Abstraction/Agents/AgentHookBase.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,4 @@ public virtual void OnAgentLoaded(Agent agent)
5656
public virtual void OnAgentUtilityLoaded(Agent agent)
5757
{
5858
}
59-
60-
public virtual void OnAgentLoadFilter(Agent agent)
61-
{
62-
63-
}
6459
}

src/Infrastructure/BotSharp.Abstraction/Agents/IAgentHook.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,4 @@ public interface IAgentHook
3333
/// <param name="agent"></param>
3434
/// <returns></returns>
3535
void OnAgentLoaded(Agent agent);
36-
37-
void OnAgentLoadFilter(Agent agent);
3836
}

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

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,14 @@ public partial class AgentService
77
{
88
public static ConcurrentDictionary<string, Dictionary<string, string>> AgentParameterTypes = new();
99

10+
[MemoryCache(10 * 60, perInstanceCache: true)]
1011
public async Task<Agent> LoadAgent(string id)
1112
{
1213
if (string.IsNullOrEmpty(id) || id == Guid.Empty.ToString())
1314
{
1415
return null;
1516
}
1617

17-
Agent agent = await GetLoadAgent(id);
18-
OnAgentLoadFilter(agent);
19-
return agent;
20-
}
21-
22-
private void OnAgentLoadFilter(Agent? agent)
23-
{
24-
if (agent != null && agent.Type == AgentType.Routing)
25-
{
26-
var hooks = _services.GetServices<IAgentHook>();
27-
foreach (var hook in hooks)
28-
{
29-
hook.OnAgentLoadFilter(agent);
30-
}
31-
}
32-
}
33-
34-
[MemoryCache(10 * 60, perInstanceCache: true)]
35-
private async Task<Agent> GetLoadAgent(string id)
36-
{
3718
var hooks = _services.GetServices<IAgentHook>();
3819

3920
// Before agent is loaded.

0 commit comments

Comments
 (0)