Merge pull request #566 from shenchucheng/fix-options-lookuperror

fix cContextVar OPTIONS LookupError
This commit is contained in:
garylin2099 2023-12-15 19:49:16 +08:00 committed by GitHub
commit f65c7a0dbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -45,9 +45,11 @@ class Config(metaclass=Singleton):
default_yaml_file = METAGPT_ROOT / "config/config.yaml"
def __init__(self, yaml_file=default_yaml_file):
golbal_options = OPTIONS.get()
self._init_with_config_files_and_env(yaml_file)
logger.debug("Config loading done.")
self._update()
golbal_options.update(OPTIONS.get())
def _update(self):
# logger.info("Config loading done.")

View file

@ -17,7 +17,7 @@ from loguru import logger
import metagpt
OPTIONS = contextvars.ContextVar("OPTIONS")
OPTIONS = contextvars.ContextVar("OPTIONS", default={})
def get_metagpt_package_root():