mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
75 lines
2.7 KiB
C#
75 lines
2.7 KiB
C#
// ------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was generated by a tool.
|
|
// Runtime Version: 18.0.0.0
|
|
//
|
|
// Changes to this file may cause incorrect behavior and will be lost if
|
|
// the code is regenerated.
|
|
// </auto-generated>
|
|
// ------------------------------------------------------------------------------
|
|
namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen
|
|
{
|
|
using Microsoft.Agents.ObjectModel;
|
|
using System;
|
|
|
|
/// <summary>
|
|
/// Class to produce the template output
|
|
/// </summary>
|
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "18.0.0.0")]
|
|
internal partial class ResetVariableTemplate : ActionTemplate
|
|
{
|
|
/// <summary>
|
|
/// Create the template output
|
|
/// </summary>
|
|
public override string TransformText()
|
|
{
|
|
this.Write("\n");
|
|
this.Write("\n");
|
|
this.Write("\n");
|
|
this.Write("\n");
|
|
this.Write("\n/// <summary>\n/// Resets the value of the \"");
|
|
this.Write(this.ToStringHelper.ToStringWithCulture(this.Model.Variable));
|
|
this.Write("\" variable, potentially causing re-evaluation \n/// of the default value, question" +
|
|
" or action that provides the value to this variable.\n/// </summary>\ninternal sea" +
|
|
"led class ");
|
|
this.Write(this.ToStringHelper.ToStringWithCulture(this.Name));
|
|
this.Write("Executor(FormulaSession session) : ActionExecutor(id: \"");
|
|
this.Write(this.ToStringHelper.ToStringWithCulture(this.Id));
|
|
this.Write("\", session)\n{\n protected override async ValueTask<object?> ExecuteAsync(IWorkf" +
|
|
"lowContext context, CancellationToken cancellationToken)\n {");
|
|
|
|
AssignVariable(this.Variable, "UnassignedValue.Instance");
|
|
this.Write("\n return default;\n }\n}");
|
|
return this.GenerationEnvironment.ToString();
|
|
}
|
|
|
|
void AssignVariable(PropertyPath targetVariable, string valueVariable, bool tightFormat = false)
|
|
{
|
|
if (targetVariable is not null)
|
|
{
|
|
this.Write("\n await context.QueueStateUpdateAsync(key: \"");
|
|
|
|
this.Write(this.ToStringHelper.ToStringWithCulture(VariableName(targetVariable)));
|
|
|
|
this.Write("\", value: ");
|
|
|
|
this.Write(this.ToStringHelper.ToStringWithCulture(valueVariable));
|
|
|
|
this.Write(", scopeName: \"");
|
|
|
|
this.Write(this.ToStringHelper.ToStringWithCulture(VariableScope(targetVariable)));
|
|
|
|
this.Write("\").ConfigureAwait(false);");
|
|
|
|
|
|
if (!tightFormat)
|
|
{
|
|
this.Write("\n ");
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|