19 lines
741 B
C#
19 lines
741 B
C#
using MAF1.Agents.Weather;
|
|||
|
|
using MAF1.PluginContract;
|
||
|
|
using MAF1.Tools;
|
||
|
|
using MAF1.Utils;
|
||
|
|
using Microsoft.Extensions.Configuration;
|
||
|
|
|
||
|
|
PluginRequest request = await PluginStdio.ReadRequestAsync();
|
||
|
|
PluginStdio.ApplyCredentialsToEnvironment(request.Credentials);
|
||
|
|
|
||
|
|
IConfiguration config = PluginStdio.LoadHostConfiguration();
|
||
|
|
AgentFactory factory = new(AgentFactory.Load(config));
|
||
|
|
WeatherOptions weatherOptions = config.GetSection("Weather").Get<WeatherOptions>() ?? new WeatherOptions();
|
||
|
|
using HttpClient http = WeatherTools.CreateHttpClient();
|
||
|
|
var result = await WeatherAgent.RunAsync(
|
||
|
|
WeatherAgent.Create(factory, new WeatherTools(weatherOptions, http)),
|
||
|
|
request.Inputs);
|
||
|
|
await PluginStdio.WriteOutputsAsync(result.Outputs);
|
||
|
|
return 0;
|