mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
feat: replace global CONTEXT with Config()
fixbug: unit test
This commit is contained in:
parent
ff314388bb
commit
e8b3e6762b
15 changed files with 44 additions and 33 deletions
|
|
@ -13,7 +13,7 @@ import aiofiles
|
|||
import yaml
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
from metagpt.context import CONTEXT, Context
|
||||
from metagpt.context import Context
|
||||
|
||||
|
||||
class Example(BaseModel):
|
||||
|
|
@ -73,14 +73,15 @@ class SkillsDeclaration(BaseModel):
|
|||
skill_data = yaml.safe_load(data)
|
||||
return SkillsDeclaration(**skill_data)
|
||||
|
||||
def get_skill_list(self, entity_name: str = "Assistant", context: Context = CONTEXT) -> Dict:
|
||||
def get_skill_list(self, entity_name: str = "Assistant", context: Context = None) -> Dict:
|
||||
"""Return the skill name based on the skill description."""
|
||||
entity = self.entities.get(entity_name)
|
||||
if not entity:
|
||||
return {}
|
||||
|
||||
# List of skills that the agent chooses to activate.
|
||||
agent_skills = context.kwargs.agent_skills
|
||||
ctx = context or Context()
|
||||
agent_skills = ctx.kwargs.agent_skills
|
||||
if not agent_skills:
|
||||
return {}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue