初始提交
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using MAF1.Agents.FileCity;
|
||||
using Microsoft.Agents.AI.Workflows;
|
||||
|
||||
namespace MAF1.Workflows;
|
||||
|
||||
/// <summary>
|
||||
/// 只有「没有城市」那条边会进到这里,所以这里不再判断。
|
||||
/// </summary>
|
||||
internal sealed class SkipWeatherExecutor() : Executor<CityExtraction>("SkipWeather")
|
||||
{
|
||||
protected override ProtocolBuilder ConfigureProtocol(ProtocolBuilder builder)
|
||||
{
|
||||
return base.ConfigureProtocol(builder).YieldsOutput<string>();
|
||||
}
|
||||
|
||||
public override async ValueTask HandleAsync(
|
||||
CityExtraction extraction,
|
||||
IWorkflowContext context,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
string reason = string.IsNullOrWhiteSpace(extraction.Reason)
|
||||
? "文件里没有可查询的城市。"
|
||||
: extraction.Reason;
|
||||
await context.YieldOutputAsync(
|
||||
$"没有有效城市,工作流结束,不执行 WeatherAgent。{reason}",
|
||||
cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user