mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
20 lines
1.0 KiB
Plaintext
20 lines
1.0 KiB
Plaintext
<#@ template language="C#" inherits="ActionTemplate" visibility="internal" linePragmas="false" #>
|
|
<#@ output extension=".cs" #>
|
|
<#@ assembly name="System.Core" #>
|
|
<#@ import namespace="Microsoft.Agents.ObjectModel" #>
|
|
<#@ include file="Snippets/AssignVariableTemplate.tt" once="true" #>
|
|
/// <summary>
|
|
/// Creates a new conversation and stores the identifier value to the "<#= this.Model.ConversationId #>" variable.
|
|
/// </summary>
|
|
internal sealed class <#= this.Name #>Executor(FormulaSession session, ResponseAgentProvider agentProvider) : ActionExecutor(id: "<#= this.Id #>", session)
|
|
{
|
|
protected override async ValueTask<object?> ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)
|
|
{
|
|
string conversationId = await agentProvider.CreateConversationAsync(cancellationToken).ConfigureAwait(false);<#
|
|
AssignVariable(this.ConversationId, "conversationId");#>
|
|
await context.AddEventAsync(new ConversationUpdateEvent(conversationId)).ConfigureAwait(false);
|
|
|
|
return default;
|
|
}
|
|
}
|