chore: 修复单测依赖问题(忽略安卓单测)

This commit is contained in:
voidking 2024-07-16 15:21:50 +08:00
parent 0c2b7dad3d
commit 20b3623536
6 changed files with 40 additions and 36 deletions

View file

@ -10,9 +10,9 @@ from typing import Optional
from pydantic import field_validator
from metagpt.const import LLM_API_TIMEOUT
from metagpt.const import CONFIG_ROOT, LLM_API_TIMEOUT, METAGPT_ROOT
from metagpt.utils.yaml_model import YamlModel
from metagpt.const import METAGPT_ROOT, CONFIG_ROOT
class LLMType(Enum):
OPENAI = "openai"
@ -97,12 +97,13 @@ class LLMConfig(YamlModel):
repo_config_path = METAGPT_ROOT / "config/config2.yaml"
root_config_path = CONFIG_ROOT / "config2.yaml"
if root_config_path.exists():
raise ValueError(
f"Please set your API key in {root_config_path}. If you also set your config in {repo_config_path}, \nthe former will overwrite the latter. This may cause unexpected result.\n")
raise ValueError(
f"Please set your API key in {root_config_path}. If you also set your config in {repo_config_path}, \nthe former will overwrite the latter. This may cause unexpected result.\n"
)
elif repo_config_path.exists():
raise ValueError(f"Please set your API key in {repo_config_path}")
else:
raise ValueError(f"Please set your API key in config2.yaml")
raise ValueError("Please set your API key in config2.yaml")
return v
@field_validator("timeout")