feat: Role有2个动作(action-A和action-B),role是否应该通过给自己发消息触发内部动作循环/执行

This commit is contained in:
莘权 马 2024-05-06 11:58:41 +08:00
parent 2cf28e5a18
commit 3ad3882bd8

View file

@ -443,6 +443,9 @@ class Role(SerializationMixin, ContextMixin, BaseModel):
"""If the role belongs to env, then the role's messages will be broadcast to env"""
if not msg:
return
if all(to in {any_to_str(self), self.name} for to in msg.send_to): # Message to myself
self.put_message(msg)
return
if not self.rc.env:
# If env does not exist, do not publish the message
return