mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-14 15:25:17 +02:00
support Message() without content param
This commit is contained in:
parent
4bf1844022
commit
64c5673d6a
7 changed files with 24 additions and 14 deletions
|
|
@ -23,7 +23,7 @@ def test_all_messages():
|
|||
UserMessage(test_content),
|
||||
SystemMessage(test_content),
|
||||
AIMessage(test_content),
|
||||
Message(test_content, role="QA"),
|
||||
Message(content=test_content, role="QA"),
|
||||
]
|
||||
for msg in msgs:
|
||||
assert msg.content == test_content
|
||||
|
|
|
|||
|
|
@ -13,12 +13,12 @@ async def test_subscription_run():
|
|||
|
||||
async def trigger():
|
||||
while True:
|
||||
yield Message("the latest news about OpenAI")
|
||||
yield Message(content="the latest news about OpenAI")
|
||||
await asyncio.sleep(3600 * 24)
|
||||
|
||||
class MockRole(Role):
|
||||
async def run(self, message=None):
|
||||
return Message("")
|
||||
return Message(content="")
|
||||
|
||||
async def callback(message):
|
||||
nonlocal callback_done
|
||||
|
|
@ -61,11 +61,11 @@ async def test_subscription_run():
|
|||
async def test_subscription_run_error(loguru_caplog):
|
||||
async def trigger1():
|
||||
while True:
|
||||
yield Message("the latest news about OpenAI")
|
||||
yield Message(content="the latest news about OpenAI")
|
||||
await asyncio.sleep(3600 * 24)
|
||||
|
||||
async def trigger2():
|
||||
yield Message("the latest news about OpenAI")
|
||||
yield Message(content="the latest news about OpenAI")
|
||||
|
||||
class MockRole1(Role):
|
||||
async def run(self, message=None):
|
||||
|
|
@ -73,7 +73,7 @@ async def test_subscription_run_error(loguru_caplog):
|
|||
|
||||
class MockRole2(Role):
|
||||
async def run(self, message=None):
|
||||
return Message("")
|
||||
return Message(content="")
|
||||
|
||||
async def callback(msg: Message):
|
||||
print(msg)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class TestGetProjectRoot:
|
|||
Input(x=RunCode, want="metagpt.actions.run_code.RunCode"),
|
||||
Input(x=RunCode(), want="metagpt.actions.run_code.RunCode"),
|
||||
Input(x=Message, want="metagpt.schema.Message"),
|
||||
Input(x=Message(""), want="metagpt.schema.Message"),
|
||||
Input(x=Message(content=""), want="metagpt.schema.Message"),
|
||||
Input(x="A", want="A"),
|
||||
]
|
||||
for i in inputs:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue