mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-06-08 15:05:17 +02:00
fixbug: runtime options
This commit is contained in:
parent
aaf18d2641
commit
c677897561
1 changed files with 8 additions and 2 deletions
|
|
@ -14,7 +14,9 @@ from __future__ import annotations
|
|||
from typing import Iterable, Type, Dict
|
||||
|
||||
from 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, CostManager
|
||||
from metagpt.actions import Action, ActionOutput
|
||||
from metagpt.logs import logger
|
||||
from 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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue