Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Infrastructure/BotSharp.Abstraction/Rules/IRuleTrigger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ public interface IRuleTrigger
/// Explain the purpose of rule trigger (display purpose)
/// </summary>
string Statement => string.Empty;

/// <summary>
/// Optional list of agent IDs this trigger is associated with.
/// Used for display/filtering in UI only (not used in execution logic).
/// </summary>
string[] AgentIds => [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ namespace BotSharp.OpenAPI.Controllers;

public partial class AgentController
{
[HttpGet("/rule/triggers/{agentId}")]
public IEnumerable<AgentRuleViewModel> GetRuleTriggers(string agentId)
{
var triggers = _services.GetServices<IRuleTrigger>();
triggers = triggers.Where(x => x.AgentIds?.Count() == 0 || x.AgentIds.Contains(agentId));
Comment thread
visagang marked this conversation as resolved.
Outdated
return triggers.Select(x => new AgentRuleViewModel
{
TriggerName = x.Name,
Channel = x.Channel,
Statement = x.Statement,
OutputArgs = x.OutputArgs
}).OrderBy(x => x.TriggerName);
}

[HttpGet("/rule/triggers")]
public IEnumerable<AgentRuleViewModel> GetRuleTriggers()
{
Expand Down
Loading