// ------------------------------------------------------------------------------ // // 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. // // ------------------------------------------------------------------------------ namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen { using Microsoft.Agents.ObjectModel; using System; /// /// Class to produce the template output /// [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "18.0.0.0")] internal partial class CreateConversationTemplate : ActionTemplate { /// /// Create the template output /// public override string TransformText() { this.Write("\n"); this.Write("\n"); this.Write("\n"); this.Write("\n"); this.Write("\n/// \n/// Creates a new conversation and stores the identifier value to " + "the \""); this.Write(this.ToStringHelper.ToStringWithCulture(this.Model.ConversationId)); this.Write("\" variable.\n/// \ninternal sealed class "); this.Write(this.ToStringHelper.ToStringWithCulture(this.Name)); this.Write("Executor(FormulaSession session, ResponseAgentProvider agentProvider) : ActionExe" + "cutor(id: \""); this.Write(this.ToStringHelper.ToStringWithCulture(this.Id)); this.Write(@""", session) { protected override async ValueTask ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken) { string conversationId = await agentProvider.CreateConversationAsync(cancellationToken).ConfigureAwait(false);"); AssignVariable(this.ConversationId, "conversationId"); this.Write("\n await context.AddEventAsync(new ConversationUpdateEvent(conversationId))" + ".ConfigureAwait(false);\n\n return default;\n }\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 "); } } } } }