mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-04-25 00:36:55 +02:00
fix bug
This commit is contained in:
parent
c7314e31b8
commit
db8b2976a1
10 changed files with 17 additions and 11 deletions
|
|
@ -10,7 +10,7 @@ import numpy.typing as npt
|
|||
from gymnasium import spaces
|
||||
from pydantic import ConfigDict, Field, field_validator
|
||||
|
||||
from metagpt.environment.base_env_space import (
|
||||
from metagpt.base.base_env_space import (
|
||||
BaseEnvAction,
|
||||
BaseEnvActionType,
|
||||
BaseEnvObsParams,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
from gymnasium import spaces
|
||||
from pydantic import ConfigDict, Field
|
||||
|
||||
from metagpt.environment.base_env_space import BaseEnvAction, BaseEnvActionType
|
||||
from metagpt.base.base_env_space import BaseEnvAction, BaseEnvActionType
|
||||
from metagpt.environment.werewolf.const import STEP_INSTRUCTIONS
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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":
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ from llama_index.core.schema import (
|
|||
TransformComponent,
|
||||
)
|
||||
|
||||
from metagpt.config2 import config
|
||||
from metagpt.config2 import Config
|
||||
from metagpt.rag.factories import (
|
||||
get_index,
|
||||
get_rag_embedding,
|
||||
|
|
@ -400,6 +400,7 @@ class SimpleEngine(RetrieverQueryEngine):
|
|||
dict[file_type: BaseReader]
|
||||
"""
|
||||
file_extractor: dict[str:BaseReader] = {}
|
||||
config = Config.default()
|
||||
if config.omniparse.base_url:
|
||||
pdf_parser = OmniParse(
|
||||
api_key=config.omniparse.api_key,
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -43,7 +43,7 @@ extras_require = {
|
|||
"llama-index-postprocessor-cohere-rerank==0.1.4",
|
||||
"llama-index-postprocessor-colbert-rerank==0.1.1",
|
||||
"llama-index-postprocessor-flag-embedding-reranker==0.1.2",
|
||||
# "llama-index-vector-stores-milvus==0.1.23",
|
||||
"llama-index-vector-stores-milvus==0.1.23",
|
||||
"docx2txt==0.8",
|
||||
],
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue