rm forward_message

This commit is contained in:
yzlin 2024-04-25 12:00:32 +08:00
parent f621186c2e
commit e39f7ff0b1
8 changed files with 26 additions and 65 deletions

View file

@ -190,7 +190,7 @@ class Environment(ExtEnv):
found = True
if not found:
logger.warning(f"Message no recipients: {message.dump()}")
# self.history += f"\n{message}" # For debug
self.history += f"\n{message}" # For debug
return True

View file

@ -6,8 +6,6 @@ from metagpt.schema import Message
class MGXEnv(Environment):
"""MGX Environment"""
history: dict[str, Message] = {} # redefine message history
def _publish_message(self, message: Message, peekable: bool = True) -> bool:
return super().publish_message(message, peekable)
@ -28,16 +26,8 @@ class MGXEnv(Environment):
# every regular message goes through team leader
tl.put_message(message)
self.history[message.id] = message
return True
def forward_message(self, message_id: str) -> str:
if message_id not in self.history:
return f"invalid message_id {message_id}, not found in history."
msg = self.history[message_id]
return self._publish_message(msg)
async def ask_human(self, question: str) -> str:
# NOTE: Can be overwritten in remote setting
return get_human_input(question)