2023-08-18 02:44:49 +00:00
|
|
|
using BotSharp.Abstraction.Agents.Models;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Core.Agents.Services;
|
|
|
|
|
|
|
|
|
|
public abstract class AgentHookBase : IAgentHook
|
|
|
|
|
{
|
|
|
|
|
protected Agent _agent;
|
|
|
|
|
public Agent Agent => _agent;
|
|
|
|
|
|
2023-08-25 15:33:21 +00:00
|
|
|
protected readonly IServiceProvider _services;
|
|
|
|
|
protected readonly AgentSettings _settings;
|
2023-08-18 02:44:49 +00:00
|
|
|
|
2023-08-25 15:33:21 +00:00
|
|
|
public AgentHookBase(IServiceProvider services, AgentSettings settings)
|
2023-08-18 02:44:49 +00:00
|
|
|
{
|
|
|
|
|
_services = services;
|
2023-08-25 15:33:21 +00:00
|
|
|
_settings = settings;
|
2023-08-18 02:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetAget(Agent agent)
|
|
|
|
|
{
|
|
|
|
|
_agent = agent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual bool OnAgentLoading(ref string id)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual bool OnInstructionLoaded(string template, Dictionary<string, object> dict)
|
|
|
|
|
{
|
2023-08-25 15:33:21 +00:00
|
|
|
return true;
|
2023-08-18 02:44:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual bool OnFunctionsLoaded(ref string functions)
|
|
|
|
|
{
|
|
|
|
|
_agent.Functions = functions;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual bool OnSamplesLoaded(ref string samples)
|
|
|
|
|
{
|
|
|
|
|
_agent.Samples = samples;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void OnAgentLoaded(Agent agent)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
}
|