.NET: NET Workflows - Skip conversation initialization when identifier is provided (#1087)

* Fix

* Code-gen case

* Tests

* Autosend logic

* Build fix

* Namespace

* Validation enhancement
This commit is contained in:
Chris
2025-10-02 14:27:46 +00:00
committed by GitHub
parent cb62407fb8
commit 08ea625de0
23 changed files with 102 additions and 31 deletions
@@ -1,7 +1,7 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version: 18.0.0.0
// Runtime Version: 17.0.0.0
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -19,7 +19,7 @@ namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen
/// <summary>
/// Class to produce the template output
/// </summary>
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "18.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.TextTemplating", "17.0.0.0")]
internal partial class CreateConversationTemplate : ActionTemplate
{
/// <summary>
@@ -59,8 +59,8 @@ namespace Microsoft.Agents.AI.Workflows.Declarative.CodeGen
string conversationId = await agentProvider.CreateConversationAsync(cancellationToken).ConfigureAwait(false);");
AssignVariable(this.ConversationId, "conversationId");
this.Write("\n return default;\n }\n}\n");
this.Write("\n await context.AddEventAsync(new ConversationUpdateEvent(conversationId))" +
".ConfigureAwait(false);\n\n return default;\n }\n}\n");
return this.GenerationEnvironment.ToString();
}
@@ -10,8 +10,9 @@ internal sealed class <#= this.Name #>Executor(FormulaSession session, WorkflowA
protected override async ValueTask<object?> ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)
{
string conversationId = await agentProvider.CreateConversationAsync(cancellationToken).ConfigureAwait(false);<#
AssignVariable(this.ConversationId, "conversationId");
#>
AssignVariable(this.ConversationId, "conversationId");#>
await context.AddEventAsync(new ConversationUpdateEvent(conversationId)).ConfigureAwait(false);
return default;
}
}