mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-01 11:56:24 +02:00
feat: +OAS framework
This commit is contained in:
parent
966d7f212f
commit
de610df25d
9 changed files with 282 additions and 55 deletions
|
|
@ -4,14 +4,18 @@
|
|||
@Time : 2023/4/29 16:07
|
||||
@Author : alexanderwu
|
||||
@File : common.py
|
||||
@Modified By: mashenquan, 2023-8-17, add `initalize_enviroment()` to load `config/config.yaml` to `os.environ`
|
||||
"""
|
||||
import ast
|
||||
import contextlib
|
||||
import inspect
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple
|
||||
|
||||
import yaml
|
||||
|
||||
from metagpt.logs import logger
|
||||
|
||||
|
||||
|
|
@ -254,3 +258,12 @@ def parse_recipient(text):
|
|||
pattern = r"## Send To:\s*([A-Za-z]+)\s*?" # hard code for now
|
||||
recipient = re.search(pattern, text)
|
||||
return recipient.group(1) if recipient else ""
|
||||
|
||||
|
||||
def initalize_enviroment():
|
||||
"""Load `config/config.yaml` to `os.environ`"""
|
||||
yaml_file_path = Path(__file__).resolve().parent.parent.parent / "config/config.yaml"
|
||||
with open(str(yaml_file_path), "r") as yaml_file:
|
||||
data = yaml.safe_load(yaml_file)
|
||||
for k, v in data.items():
|
||||
os.environ[k] = str(v)
|
||||
Loading…
Add table
Add a link
Reference in a new issue