mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-23 15:48:11 +02:00
fix role add actions
This commit is contained in:
parent
83dbf97819
commit
7d523b3922
4 changed files with 23 additions and 16 deletions
|
|
@ -17,9 +17,11 @@ from metagpt.roles.role import Role
|
|||
from metagpt.schema import Message
|
||||
from metagpt.utils.common import format_trackback_info
|
||||
from tests.metagpt.serialize_deserialize.test_serdeser_base import (
|
||||
ActionOK,
|
||||
RoleA,
|
||||
RoleB,
|
||||
RoleC,
|
||||
RoleD,
|
||||
serdeser_path,
|
||||
)
|
||||
|
||||
|
|
@ -31,6 +33,9 @@ def test_roles():
|
|||
assert len(role_a.rc.watch) == 1
|
||||
assert len(role_b.rc.watch) == 1
|
||||
|
||||
role_d = RoleD(actions=[ActionOK()])
|
||||
assert len(role_d.actions) == 1
|
||||
|
||||
|
||||
def test_role_serialize():
|
||||
role = Role()
|
||||
|
|
|
|||
|
|
@ -91,3 +91,10 @@ class RoleC(Role):
|
|||
self._watch([UserRequirement])
|
||||
self.rc.react_mode = RoleReactMode.BY_ORDER
|
||||
self.rc.memory.ignore_id = True
|
||||
|
||||
|
||||
class RoleD(Role):
|
||||
name: str = Field(default="RoleD")
|
||||
profile: str = Field(default="Role D")
|
||||
goal: str = "RoleD's goal"
|
||||
constraints: str = "RoleD's constraints"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue