初始提交

This commit is contained in:
2026-08-26 18:06:02 +08:00
commit 5544788917
53 changed files with 4101 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
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;
+12
View File
@@ -0,0 +1,12 @@
# Weather 插件
独立进程。启动命令只看 `plugin.json``launch`
## 输入 / 输出
- 输入 `cities`(字符串数组,与代码、清单同名)
- 输出 `summary`
## 凭据
LLM 的 endpoint / apiKey 由宿主注入,不出现在流程图端口上。天气 HTTP 配置走宿主 `appsettings.json`(通过环境变量 `MAF1_CONTENT_ROOT` 定位)。
+23
View File
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\MAF1.Core\MAF1.Core.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="plugin.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="README.md">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
+30
View File
@@ -0,0 +1,30 @@
{
"id": "weather",
"name": "WeatherAgent",
"description": "按城市列表查询天气并汇总。",
"version": "1.0.0",
"timeoutSeconds": 180,
"launch": {
"command": "dotnet",
"args": ["WeatherPlugin.dll"]
},
"credentials": [
{
"name": "llm",
"type": "openai-compatible",
"required": true,
"description": "由宿主注入 OpenAI 兼容的 endpoint / apiKey / model,不要写进本文件。"
}
],
"inputs": [
{
"name": "cities",
"type": "string[]",
"required": true,
"description": "要查询的城市名列表"
}
],
"outputs": [
{ "name": "summary", "type": "string", "description": "天气汇总文本" }
]
}