Skip to content

🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming

fixbug: +缺省值

莘权 马ac744062609d
diff --git a/metagpt/actions/action.py b/metagpt/actions/action.py
index 86a6664ba..10579d4f4 100644
--- a/metagpt/actions/action.py
+++ b/metagpt/actions/action.py
@@ -12,13 +12,14 @@ from typing import Optional
from tenacity import retry, stop_after_attempt, wait_fixed
from metagpt.actions.action_output import ActionOutput
+from metagpt.config import Config
from metagpt.utils.common import OutputParser
from metagpt.logs import logger
class Action(ABC):
- def __init__(self, options, name: str = '', context=None, llm=None):
- self.options = options
+ def __init__(self, options=None, name: str = '', context=None, llm=None):
+ self.options = options or Config().runtime_options
self.name: str = name
self.llm = llm
self.context = context
diff --git a/metagpt/roles/role.py b/metagpt/roles/role.py
index f605f5010..4f46bb973 100644
--- a/metagpt/roles/role.py
+++ b/metagpt/roles/role.py
@@ -103,10 +103,9 @@ class Role:
"""Role/Proxy"""
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)
+ options = options or Config().runtime_options
+ cost_manager = cost_manager or CostManager(*options)
+
self._options = Role.supply_options(options=kwargs, default_options=options)
name = Role.format_value(name, self._options)