Merge branch 'feature/inner_msg' into 'mgx_ops'

feat: Role自己的消息不经过env对象转发

See merge request pub/MetaGPT!88
This commit is contained in:
林义章 2024-05-08 11:43:15 +00:00
commit eaa78d9db4

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