初始提交
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using MAF1.Agents.FileCity;
|
||||
using MAF1.Agents.Weather;
|
||||
using MAF1.Plugins;
|
||||
using MAF1.Tools;
|
||||
using MAF1.Utils;
|
||||
using Microsoft.Agents.AI;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace MAF1.Web;
|
||||
|
||||
public sealed class AgentRuntime
|
||||
{
|
||||
public AgentRuntime(IConfiguration config)
|
||||
{
|
||||
AgentFactory factory = new(AgentFactory.Load(config));
|
||||
WeatherOptions weatherOptions = config.GetSection("Weather").Get<WeatherOptions>() ?? new WeatherOptions();
|
||||
Http = WeatherTools.CreateHttpClient();
|
||||
WeatherTools weatherTools = new(weatherOptions, Http);
|
||||
FileCity = FileCityAgent.Create(factory);
|
||||
Weather = WeatherAgent.Create(factory, weatherTools);
|
||||
PluginOptions pluginOptions = PluginOptions.Load(config);
|
||||
Credentials = new CredentialStore(config);
|
||||
Scanner = new PluginScanner(pluginOptions);
|
||||
Catalog = new NodeCatalogService(Scanner);
|
||||
PluginRunner = new PluginProcessRunner(pluginOptions, Credentials);
|
||||
Runner = new ConfigurableWorkflowRunner(FileCity, Weather, Catalog, PluginRunner);
|
||||
WeatherProvider = weatherOptions.Provider;
|
||||
PluginsRoot = pluginOptions.ResolveRoot();
|
||||
}
|
||||
|
||||
public AIAgent FileCity { get; }
|
||||
public AIAgent Weather { get; }
|
||||
public ConfigurableWorkflowRunner Runner { get; }
|
||||
public NodeCatalogService Catalog { get; }
|
||||
public PluginScanner Scanner { get; }
|
||||
public PluginProcessRunner PluginRunner { get; }
|
||||
public CredentialStore Credentials { get; }
|
||||
public string WeatherProvider { get; }
|
||||
public string PluginsRoot { get; }
|
||||
public HttpClient Http { get; }
|
||||
}
|
||||
Reference in New Issue
Block a user