mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
FIx Format and Some bugs in android_assistant.py
This commit is contained in:
parent
0f0f41fb30
commit
732cf36fbc
13 changed files with 223 additions and 143 deletions
|
|
@ -9,7 +9,12 @@ from typing import Any, Optional
|
|||
from pydantic import Field
|
||||
|
||||
from metagpt.const import ADB_EXEC_FAIL
|
||||
from metagpt.environment.base_env import Environment, ExtEnv, mark_as_readable, mark_as_writeable
|
||||
from metagpt.environment.base_env import (
|
||||
Environment,
|
||||
ExtEnv,
|
||||
mark_as_readable,
|
||||
mark_as_writeable,
|
||||
)
|
||||
|
||||
|
||||
class AndroidExtEnv(Environment, ExtEnv):
|
||||
|
|
@ -42,7 +47,7 @@ class AndroidExtEnv(Environment, ExtEnv):
|
|||
return f"adb -s {self.device_id} "
|
||||
|
||||
def execute_adb_with_cmd(self, adb_cmd: str) -> str:
|
||||
adb_cmd = adb_cmd.replace('\\', '/')
|
||||
adb_cmd = adb_cmd.replace("\\", "/")
|
||||
res = subprocess.run(adb_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||
exec_res = ADB_EXEC_FAIL
|
||||
if not res.returncode:
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ def mark_as_writeable(func):
|
|||
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