mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
eb1117fff4
* adds support for labels in edges, fixes rendering of labels in dot and mermaid, adds rendering of labels in edges * Update dotnet/src/Microsoft.Agents.AI.Workflows/Visualization/WorkflowVisualizer.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * escaping edge labels, adding tests for labels containing strange characters that would break the diagram and enabling the previous signature so the API has backwards compatibility. * Unify label in EdgeData * Edge API adjustments, removed useless "sanitizer" * fixed test --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Jacob Alber <jaalber@microsoft.com> Co-authored-by: Chris <66376200+crickman@users.noreply.github.com>
43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.Collections.Generic;
|
|
using Microsoft.Agents.AI.Workflows.Execution;
|
|
|
|
using AssignerF = System.Func<object?, int, System.Collections.Generic.IEnumerable<int>>;
|
|
|
|
namespace Microsoft.Agents.AI.Workflows;
|
|
|
|
/// <summary>
|
|
/// Represents a connection from a single node to a set of nodes, optionally associated with a paritition selector
|
|
/// function which maps incoming messages to a subset of the target set.
|
|
/// </summary>
|
|
internal sealed class FanOutEdgeData : EdgeData
|
|
{
|
|
internal FanOutEdgeData(string sourceId, List<string> sinkIds, EdgeId edgeId, AssignerF? assigner = null, string? label = null) : base(edgeId, label)
|
|
{
|
|
this.SourceId = sourceId;
|
|
this.SinkIds = sinkIds;
|
|
this.EdgeAssigner = assigner;
|
|
this.Connection = new([sourceId], sinkIds);
|
|
}
|
|
|
|
/// <summary>
|
|
/// The Id of the source <see cref="Executor"/> node.
|
|
/// </summary>
|
|
public string SourceId { get; }
|
|
|
|
/// <summary>
|
|
/// The ordered list of Ids of the destination <see cref="Executor"/> nodes.
|
|
/// </summary>
|
|
public List<string> SinkIds { get; }
|
|
|
|
/// <summary>
|
|
/// A function mapping an incoming message to a subset of the target executor nodes (or optionally all of them).
|
|
/// If <see langword="null"/>, all destination nodes are selected.
|
|
/// </summary>
|
|
public AssignerF? EdgeAssigner { get; }
|
|
|
|
/// <inheritdoc />
|
|
internal override EdgeConnection Connection { get; }
|
|
}
|