Merge branch 'mgx_ops' into fibug/quick_think_output_message_tag

This commit is contained in:
黄伟韬 2024-08-20 18:10:06 +08:00
commit e690488b08
29 changed files with 390 additions and 110 deletions

View file

@ -11,7 +11,7 @@ from metagpt.roles.di.role_zero import RoleZero
from metagpt.utils.common import tool2name
ARCHITECT_INSTRUCTION = """
Use WriteDesign tool to write a system design document if a system design is required; Use `write_trd_and_framework` tool to write a software framework if a software framework is required;
Use WriteDesign tool to write a system design document if a system design is required;
Note:
1. When you think, just analyze which tool you should use, and then provide your answer. And your output should contain firstly, secondly, ...

View file

@ -302,6 +302,10 @@ class RoleZero(Role):
# If the answer contains the substring '[Message] from A to B:', remove it.
pattern = r"\[Message\] from .+? to .+?:\s*"
answer = re.sub(pattern, "", answer, count=1)
if "command_name" in answer:
# an actual TASK intent misclassified as QUICK, correct it here, FIXME: a better way is to classify it correctly in the first place
answer = ""
intent_result = "TASK"
elif "SEARCH" in intent_result:
query = "\n".join(str(msg) for msg in memory)
answer = await SearchEnhancedQA().run(query)