File tree Expand file tree Collapse file tree
BotSharp.Abstraction/Rules
BotSharp.OpenAPI/Controllers/Agent Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,4 +21,10 @@ public interface IRuleTrigger
2121 /// Explain the purpose of rule trigger (display purpose)
2222 /// </summary>
2323 string Statement => string . Empty ;
24+
25+ /// <summary>
26+ /// Optional list of agent IDs this trigger is associated with.
27+ /// Used for display/filtering in UI only (not used in execution logic).
28+ /// </summary>
29+ string [ ] AgentIds => [ ] ;
2430}
Original file line number Diff line number Diff line change @@ -5,6 +5,20 @@ namespace BotSharp.OpenAPI.Controllers;
55
66public partial class AgentController
77{
8+ [ HttpGet ( "/rule/triggers/{agentId}" ) ]
9+ public IEnumerable < AgentRuleViewModel > GetRuleTriggers ( string agentId )
10+ {
11+ var triggers = _services . GetServices < IRuleTrigger > ( ) ;
12+ triggers = triggers . Where ( x => x . AgentIds ? . Count ( ) == 0 || x . AgentIds . Contains ( agentId ) ) ;
13+ return triggers . Select ( x => new AgentRuleViewModel
14+ {
15+ TriggerName = x . Name ,
16+ Channel = x . Channel ,
17+ Statement = x . Statement ,
18+ OutputArgs = x . OutputArgs
19+ } ) . OrderBy ( x => x . TriggerName ) ;
20+ }
21+
822 [ HttpGet ( "/rule/triggers" ) ]
923 public IEnumerable < AgentRuleViewModel > GetRuleTriggers ( )
1024 {
You can’t perform that action at this time.
0 commit comments