Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

add args for ask_human and reply_to_human

yzlin2479f75bcb7b
diff --git a/metagpt/environment/mgx/mgx_env.py b/metagpt/environment/mgx/mgx_env.py
index 17b479679..ae97d72f6 100644
--- a/metagpt/environment/mgx/mgx_env.py
+++ b/metagpt/environment/mgx/mgx_env.py
@@ -14,6 +14,7 @@ from metagpt.roles import (
ProductManager,
ProjectManager,
QaEngineer,
+ Role,
)
from metagpt.schema import Message
from metagpt.utils.common import any_to_str, any_to_str_set
@@ -58,11 +59,11 @@ class MGXEnv(Environment):
return True
- async def ask_human(self, question: str) -> str:
+ async def ask_human(self, question: str, sent_from: Role = None) -> str:
# NOTE: Can be overwritten in remote setting
return get_human_input(question)
- async def reply_to_human(self, content: str) -> str:
+ async def reply_to_human(self, content: str, sent_from: Role = None) -> str:
# NOTE: Can be overwritten in remote setting
return content
diff --git a/metagpt/roles/di/team_leader.py b/metagpt/roles/di/team_leader.py
index 0034a9eef..346535308 100644
--- a/metagpt/roles/di/team_leader.py
+++ b/metagpt/roles/di/team_leader.py
@@ -44,9 +44,9 @@ class TeamLeader(Role):
if cmd["command_name"] == Command.PUBLISH_MESSAGE.cmd_name:
self.publish_message(Message(**cmd["args"]))
elif cmd["command_name"] == Command.ASK_HUMAN.cmd_name:
- self.rc.env.ask_human(**cmd["args"])
+ self.rc.env.ask_human(sent_from=self, **cmd["args"])
elif cmd["command_name"] == Command.REPLY_TO_HUMAN.cmd_name:
- self.rc.env.reply_to_human(**cmd["args"])
+ self.rc.env.reply_to_human(sent_from=self, **cmd["args"])
def _run_internal_command(self, cmd):
if cmd["command_name"] == Command.APPEND_TASK.cmd_name: