Skip to content

Commit

Permalink
Merge branch 'main' into fix_assistant_model_call
Browse files Browse the repository at this point in the history
  • Loading branch information
rysweet authored Nov 22, 2024
2 parents 8b5095c + 97fd6cc commit 5cc9bd4
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ namespace Microsoft.AutoGen.Agents;
internal sealed class SubscriptionsGrain([PersistentState("state", "PubSubStore")] IPersistentState<SubscriptionsState> state) : Grain, ISubscriptionsGrain
{
private readonly Dictionary<string, List<string>> _subscriptions = new();
public ValueTask<Dictionary<string, List<string>>> GetSubscriptions(string agentType)
public ValueTask<Dictionary<string, List<string>>> GetSubscriptions(string? agentType = null)
{
//if agentType is null, return all subscriptions else filter on agentType
if (agentType != null)
{
return new ValueTask<Dictionary<string, List<string>>>(_subscriptions.Where(x => x.Value.Contains(agentType)).ToDictionary(x => x.Key, x => x.Value));
}
return new ValueTask<Dictionary<string, List<string>>>(_subscriptions);
}
public ValueTask Subscribe(string agentType, string topic)
Expand Down

0 comments on commit 5cc9bd4

Please sign in to comment.