mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
add args for ask_human and reply_to_human
This commit is contained in:
parent
3590cd77b6
commit
2479f75bcb
2 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue