fixbug: +缺省值

This commit is contained in:
莘权 马 2023-08-28 11:55:09 +08:00
parent c677897561
commit ac74406260
2 changed files with 6 additions and 6 deletions

View file

@ -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

View file

@ -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)