mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
* rename AgentRunResponse and AgentRunResponseUpdate classes - part1 * rename varialbles, parameters, methods and tests * rollback unnecessary changes
34 lines
1.2 KiB
Plaintext
34 lines
1.2 KiB
Plaintext
<#@ template language="C#" inherits="ActionTemplate" visibility="internal" linePragmas="false" #>
|
|
<#@ output extension=".cs" #>
|
|
<#@ assembly name="System.Core" #>
|
|
<#@ include file="Snippets/Index.tt" once="true" #>
|
|
/// <summary>
|
|
/// Formats a message template and sends an activity event.
|
|
/// </summary>
|
|
internal sealed class <#= this.Name #>Executor(FormulaSession session) : ActionExecutor(id: "<#= this.Id #>", session)
|
|
{
|
|
// <inheritdoc />
|
|
protected override async ValueTask<object?> ExecuteAsync(IWorkflowContext context, CancellationToken cancellationToken)
|
|
{ <#
|
|
if (this.Model.Activity is MessageActivityTemplate messageActivity)
|
|
{ #>
|
|
string activityText =
|
|
await context.FormatTemplateAsync( <#
|
|
foreach (TemplateLine line in messageActivity.Text)
|
|
{ #>
|
|
"""<#
|
|
foreach (string text in line.ToTemplateString().ByLine())
|
|
{ #>
|
|
<#= text #><#
|
|
} #>
|
|
"""<#
|
|
}
|
|
#>
|
|
);
|
|
AgentResponse response = new([new ChatMessage(ChatRole.Assistant, activityText)]);
|
|
await context.AddEventAsync(new AgentRunResponseEvent(this.Id, response)).ConfigureAwait(false);<#
|
|
} #>
|
|
|
|
return default;
|
|
}
|
|
} |