mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-05 14:55:18 +02:00
refactor: In accordance with Chapter 2.1.3 of RFC 116, modify the data type of the cause_by value of the Message object.
This commit is contained in:
parent
01f23d633e
commit
c502b1403a
1 changed files with 4 additions and 5 deletions
|
|
@ -4,8 +4,8 @@
|
|||
@Time : 2023/5/11 17:45
|
||||
@Author : alexanderwu
|
||||
@File : write_code.py
|
||||
@Modified By: mashenquan, 2023-11-1. According to Chapter 2.2.1 and 2.2.2 of RFC 116, change the data type of
|
||||
the `cause_by` value in the `Message` to a string to support the new message distribution feature.
|
||||
@Modified By: mashenquan, 2023-11-1. In accordance with Chapter 2.1.3 of RFC 116, modify the data type of the `cause_by`
|
||||
value of the `Message` object.
|
||||
"""
|
||||
from tenacity import retry, stop_after_attempt, wait_fixed
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ from metagpt.actions.action import Action
|
|||
from metagpt.const import WORKSPACE_ROOT
|
||||
from metagpt.logs import logger
|
||||
from metagpt.schema import Message
|
||||
from metagpt.utils.common import CodeParser
|
||||
from metagpt.utils.common import CodeParser, get_class_name
|
||||
|
||||
PROMPT_TEMPLATE = """
|
||||
NOTICE
|
||||
|
|
@ -58,8 +58,7 @@ class WriteCode(Action):
|
|||
if self._is_invalid(filename):
|
||||
return
|
||||
|
||||
message_filter = {WriteDesign}
|
||||
design = [i for i in context if i.contain_any(message_filter)][0]
|
||||
design = [i for i in context if i.cause_by == get_class_name(WriteDesign)][0]
|
||||
|
||||
ws_name = CodeParser.parse_str(block="Python package name", text=design.content)
|
||||
ws_path = WORKSPACE_ROOT / ws_name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue