mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-23 15:48:11 +02:00
feat: + subscribe
This commit is contained in:
parent
8572fa8ecd
commit
660f788683
3 changed files with 68 additions and 14 deletions
|
|
@ -134,6 +134,10 @@ class Role(Named):
|
|||
def _watch(self, actions: Iterable[Type[Action]]):
|
||||
"""Listen to the corresponding behaviors"""
|
||||
tags = [get_class_name(t) for t in actions]
|
||||
self.subscribe(tags)
|
||||
|
||||
def subscribe(self, tags: Set[str]):
|
||||
"""Listen to the corresponding behaviors"""
|
||||
self._rc.watch.update(tags)
|
||||
# check RoleContext after adding watch actions
|
||||
self._rc.check(self._role_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue