Skip to content

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

refactor: @cause_by.setter

莘权 马8ea52d8a83ce
diff --git a/examples/build_customized_agent.py b/examples/build_customized_agent.py
index af15c90ca..f7f554e53 100644
--- a/examples/build_customized_agent.py
+++ b/examples/build_customized_agent.py
@@ -2,8 +2,6 @@
Filename: MetaGPT/examples/build_customized_agent.py
Created Date: Tuesday, September 19th 2023, 6:52:25 pm
Author: garylin2099
-@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.
"""
import asyncio
import re
@@ -83,7 +81,7 @@ class SimpleCoder(Role):
instruction = msg.content
code_text = await SimpleWriteCode().run(instruction)
- msg = Message(content=code_text, role=self.profile, cause_by=get_object_name(todo))
+ msg = Message(content=code_text, role=self.profile, cause_by=todo)
return msg
diff --git a/metagpt/schema.py b/metagpt/schema.py
index 1082c5ddb..0be067cfe 100644
--- a/metagpt/schema.py
+++ b/metagpt/schema.py
@@ -135,7 +135,7 @@ class Message(BaseModel):
self.set_cause_by(v)
continue
if k == MESSAGE_ROUTE_TO:
- self.add_to(v)
+ self.add_to(any_to_str(v))
continue
self.meta_info[k] = v