mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-11 16:52:37 +02:00
Update env & test code
This commit is contained in:
parent
26bbdef6c6
commit
ba2fdb222e
11 changed files with 98 additions and 74 deletions
|
|
@ -130,8 +130,12 @@ class Config(CLIParams, YamlModel):
|
|||
def set_other(self, other: dict):
|
||||
self.other = other
|
||||
|
||||
def get_other(self, key: str):
|
||||
return self.other.get(key)
|
||||
def get_other(self, key: str, default_value: str = None):
|
||||
if default_value is None:
|
||||
return self.other.get(key)
|
||||
else:
|
||||
return self.other.get(key, default_value)
|
||||
|
||||
|
||||
def get_openai_llm(self) -> Optional[LLMConfig]:
|
||||
"""Get OpenAI LLMConfig by name. If no OpenAI, raise Exception"""
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ from typing import Any, Optional
|
|||
from pydantic import Field
|
||||
|
||||
from metagpt.const import ADB_EXEC_FAIL
|
||||
from metagpt.environment.base_env import Env, ExtEnv, mark_as_readable, mark_as_writeable
|
||||
from metagpt.environment.base_env import Environment, ExtEnv, mark_as_readable, mark_as_writeable
|
||||
|
||||
|
||||
class AndroidExtEnv(Env, ExtEnv):
|
||||
class AndroidExtEnv(Environment, ExtEnv):
|
||||
device_id: Optional[str] = Field(default=None)
|
||||
screenshot_dir: Optional[Path] = Field(default=None)
|
||||
xml_dir: Optional[Path] = Field(default=None)
|
||||
|
|
|
|||
|
|
@ -45,11 +45,10 @@ def mark_as_readable(func):
|
|||
|
||||
|
||||
def mark_as_writeable(func):
|
||||
"""mark function as a writeable one in ExtEnv, it does something to ExtEnv"""
|
||||
"""mark functionn as a writeable one in ExtEnv, it does something to ExtEnv"""
|
||||
env_write_api_registry[func.__name__] = get_function_schema(func)
|
||||
return func
|
||||
|
||||
|
||||
class ExtEnv(BaseModel):
|
||||
"""External Env to integrate actual game environment"""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue