mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.NET: [BREAKING] Remove Support for Code-Gen in Declarative Workflows (#6095)
* Removed * Remove sample * Remove orphaned code-gen related code path * Remove remaining references to code gen. --------- Co-authored-by: Chris Rickman <crickman@microsoft.com> Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
This commit is contained in:
co-authored by
Chris Rickman
Chris
parent
4c4e1d9b87
commit
5d8dd4ea4b
@@ -87,55 +87,6 @@ public static class DeclarativeWorkflowBuilder
|
||||
return visitor.Complete();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates source code (provider/executor scaffolding) for the workflow defined in the YAML file.
|
||||
/// </summary>
|
||||
/// <param name="workflowFile">The path to the workflow YAML file.</param>
|
||||
/// <param name="workflowLanguage">The language to use for the generated code.</param>
|
||||
/// <param name="workflowNamespace">Optional target namespace for the generated code.</param>
|
||||
/// <param name="workflowPrefix">Optional prefix for generated workflow type.</param>
|
||||
/// <returns>The generated source code representing the workflow.</returns>
|
||||
public static string Eject(
|
||||
string workflowFile,
|
||||
DeclarativeWorkflowLanguage workflowLanguage,
|
||||
string? workflowNamespace = null,
|
||||
string? workflowPrefix = null)
|
||||
{
|
||||
using StreamReader yamlReader = File.OpenText(workflowFile);
|
||||
return Eject(yamlReader, workflowLanguage, workflowNamespace, workflowPrefix);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generates source code (provider/executor scaffolding) for the workflow defined in the provided YAML reader.
|
||||
/// </summary>
|
||||
/// <param name="yamlReader">The reader supplying the workflow YAML.</param>
|
||||
/// <param name="workflowLanguage">The language to use for the generated code.</param>
|
||||
/// <param name="workflowNamespace">Optional target namespace for the generated code.</param>
|
||||
/// <param name="workflowPrefix">Optional prefix for generated workflow type.</param>
|
||||
/// <returns>The generated source code representing the workflow.</returns>
|
||||
public static string Eject(
|
||||
TextReader yamlReader,
|
||||
DeclarativeWorkflowLanguage workflowLanguage,
|
||||
string? workflowNamespace = null,
|
||||
string? workflowPrefix = null)
|
||||
{
|
||||
if (workflowLanguage != DeclarativeWorkflowLanguage.CSharp)
|
||||
{
|
||||
throw new NotSupportedException($"Converting workflow to {workflowLanguage} is not currently supported.");
|
||||
}
|
||||
|
||||
AdaptiveDialog workflowElement = ReadWorkflow(yamlReader);
|
||||
|
||||
string rootId = WorkflowActionVisitor.Steps.Root(workflowElement);
|
||||
WorkflowTypeInfo typeInfo = workflowElement.WrapWithBot().Describe();
|
||||
|
||||
WorkflowTemplateVisitor visitor = new(rootId, typeInfo);
|
||||
WorkflowElementWalker walker = new(visitor);
|
||||
walker.Visit(workflowElement);
|
||||
|
||||
return visitor.Complete(workflowNamespace, workflowPrefix);
|
||||
}
|
||||
|
||||
private static AdaptiveDialog ReadWorkflow(TextReader yamlReader)
|
||||
{
|
||||
BotElement rootElement = YamlSerializer.Deserialize<BotElement>(yamlReader) ?? throw new DeclarativeModelException("Workflow undefined.");
|
||||
|
||||
Reference in New Issue
Block a user