mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
fixbug: role init with is_human=True was not work
This commit is contained in:
parent
ce3dc74ef3
commit
6cde039f7f
2 changed files with 7 additions and 0 deletions
|
|
@ -166,6 +166,9 @@ class Role(SerializationMixin, is_polymorphic_base=True):
|
|||
Role.model_rebuild()
|
||||
super().__init__(**data)
|
||||
|
||||
if data.get("is_human"):
|
||||
self.llm = HumanProvider()
|
||||
|
||||
self.llm.system_prompt = self._get_prefix()
|
||||
self._watch(data.get("watch") or [UserRequirement])
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
import pytest
|
||||
|
||||
from metagpt.roles.role import Role
|
||||
from metagpt.llm import HumanProvider
|
||||
|
||||
|
||||
def test_role_desc():
|
||||
|
|
@ -11,6 +12,9 @@ def test_role_desc():
|
|||
assert role.profile == "Sales"
|
||||
assert role.desc == "Best Seller"
|
||||
|
||||
def test_role_human():
|
||||
role = Role(is_human=True)
|
||||
assert isinstance(role.llm, HumanProvider)
|
||||
|
||||
if __name__ == "__main__":
|
||||
pytest.main([__file__, "-s"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue