🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
fixbug: runtime options
莘权 马c67789756147
diff --git a/metagpt/roles/role.py b/metagpt/roles/role.pyindex ed02575db..f605f5010 100644--- a/metagpt/roles/role.py+++ b/metagpt/roles/role.py@@ -14,7 +14,9 @@ from __future__ import annotationsfrom typing import Iterable, Type, Dictfrom pydantic import BaseModel, Field-from metagpt.provider.openai_api import OpenAIGPTAPI as LLM++from metagpt.config import Config+from metagpt.provider.openai_api import OpenAIGPTAPI as LLM, CostManagerfrom metagpt.actions import Action, ActionOutputfrom metagpt.logs import loggerfrom metagpt.memory import Memory, LongTermMemory@@ -100,7 +102,11 @@ class RoleContext(BaseModel):class Role:"""Role/Proxy"""- def __init__(self, options, cost_manager, name="", profile="", goal="", constraints="", desc="", *args, **kwargs):+ def __init__(self, options=None, cost_manager=None, name="", profile="", goal="", constraints="", desc="", *args, **kwargs):+ if not options:+ options = Config().runtime_options+ if not cost_manager:+ cost_manager = CostManager(*options)self._options = Role.supply_options(options=kwargs, default_options=options)name = Role.format_value(name, self._options)