mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-26 01:06:27 +02:00
fix bug
This commit is contained in:
parent
c7314e31b8
commit
db8b2976a1
10 changed files with 17 additions and 11 deletions
|
|
@ -7,7 +7,7 @@ from pathlib import Path
|
|||
import cv2
|
||||
|
||||
from metagpt.actions.action import Action
|
||||
from metagpt.config2 import config
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.environment.android.android_env import AndroidEnv
|
||||
from metagpt.environment.android.const import ADB_EXEC_FAIL
|
||||
from metagpt.environment.android.env_space import (
|
||||
|
|
@ -55,6 +55,7 @@ class ManualRecord(Action):
|
|||
self.task_desc_path.write_text(task_desc)
|
||||
|
||||
step = 0
|
||||
config = Config.default()
|
||||
extra_config = config.extra
|
||||
while True:
|
||||
step += 1
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import re
|
|||
from pathlib import Path
|
||||
|
||||
from metagpt.actions.action import Action
|
||||
from metagpt.config2 import config
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.ext.android_assistant.actions.parse_record_an import RECORD_PARSE_NODE
|
||||
from metagpt.ext.android_assistant.prompts.operation_prompt import (
|
||||
long_press_doc_template,
|
||||
|
|
@ -45,6 +45,7 @@ class ParseRecord(Action):
|
|||
path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
task_desc = self.task_desc_path.read_text()
|
||||
config = Config.default()
|
||||
extra_config = config.extra
|
||||
|
||||
with open(self.record_path, "r") as record_file:
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import ast
|
|||
from pathlib import Path
|
||||
|
||||
from metagpt.actions.action import Action
|
||||
from metagpt.config2 import config
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.environment.android.android_env import AndroidEnv
|
||||
from metagpt.environment.android.const import ADB_EXEC_FAIL
|
||||
from metagpt.environment.android.env_space import (
|
||||
|
|
@ -101,6 +101,7 @@ next action. You should always prioritize these documented elements for interact
|
|||
grid_on: bool,
|
||||
env: AndroidEnv,
|
||||
):
|
||||
config = Config.default()
|
||||
extra_config = config.extra
|
||||
for path in [task_dir, docs_dir]:
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import ast
|
|||
from pathlib import Path
|
||||
|
||||
from metagpt.actions.action import Action
|
||||
from metagpt.config2 import config
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.environment.android.android_env import AndroidEnv
|
||||
from metagpt.environment.android.const import ADB_EXEC_FAIL
|
||||
from metagpt.environment.android.env_space import (
|
||||
|
|
@ -80,6 +80,7 @@ class SelfLearnAndReflect(Action):
|
|||
async def run_self_learn(
|
||||
self, round_count: int, task_desc: str, last_act: str, task_dir: Path, env: AndroidEnv
|
||||
) -> AndroidActionOutput:
|
||||
config = Config.default()
|
||||
extra_config = config.extra
|
||||
screenshot_path: Path = env.observe(
|
||||
EnvObsParams(obs_type=EnvObsType.GET_SCREENSHOT, ss_name=f"{round_count}_before", local_save_dir=task_dir)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ from typing import Optional
|
|||
from pydantic import Field
|
||||
|
||||
from metagpt.actions.add_requirement import UserRequirement
|
||||
from metagpt.config2 import config
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.const import EXAMPLE_PATH
|
||||
from metagpt.ext.android_assistant.actions.manual_record import ManualRecord
|
||||
from metagpt.ext.android_assistant.actions.parse_record import ParseRecord
|
||||
|
|
@ -38,7 +38,7 @@ class AndroidAssistant(Role):
|
|||
|
||||
def __init__(self, **data):
|
||||
super().__init__(**data)
|
||||
|
||||
config = Config.default()
|
||||
self._watch([UserRequirement, AndroidActionOutput])
|
||||
extra_config = config.extra
|
||||
self.task_desc = extra_config.get("task_desc", "Just explore any app in this phone!")
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ from xml.etree.ElementTree import Element, iterparse
|
|||
import cv2
|
||||
import pyshine as ps
|
||||
|
||||
from metagpt.config2 import config
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.ext.android_assistant.utils.schema import (
|
||||
ActionOp,
|
||||
AndroidElement,
|
||||
|
|
@ -48,6 +48,7 @@ def get_id_from_element(elem: Element) -> str:
|
|||
|
||||
def traverse_xml_tree(xml_path: Path, elem_list: list[AndroidElement], attrib: str, add_index=False):
|
||||
path = []
|
||||
config = Config.default()
|
||||
extra_config = config.extra
|
||||
for event, elem in iterparse(str(xml_path), ["start", "end"]):
|
||||
if event == "start":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue