mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-15 11:02:36 +02:00
update andriod_assistant const and test data
This commit is contained in:
parent
367fefbbc5
commit
e2ed85f197
5 changed files with 32 additions and 22 deletions
|
|
@ -17,13 +17,13 @@ ## Experiential Learning
|
|||
By designating the app to explore and the method of learning (automatic or manual demonstration), you can facilitate Android Assistant to master the functions of various apps, thereby generating respective documentation for later use during the phase termed as "Automation of routine tasks". For any given task objective, conducting approximately 20 cycles of exploration can considerably enhance the performance. You can experiment with both the automatic learning and manual demonstration modes for the "contacts" app by implementing the ensuing commands:
|
||||
|
||||
```bash
|
||||
python run_assistant.py "your task description" --stage "learn" --mode "auto/manual" --app-name "Contacts"
|
||||
python run_assistant.py "your task description" --stage "learn" --mode "auto or manual" --app-name "Contacts"
|
||||
```
|
||||
## Free Your Hands
|
||||
Once the Android Assistant has completed ample exploration, you are all set to automate your tasks! By utilizing either text description or voice input, you can instruct the Android Assistant to perform the desired tasks across various applications. For the specific command processes, please see the following recommendations:
|
||||
### By Text
|
||||
```bash
|
||||
python run_assistant.py "your task description" --stage "act" --mode "auto/manual" --app-name "app names"
|
||||
python run_assistant.py "your task description" --stage "act" --mode "auto or manual" --app-name "app names"
|
||||
```
|
||||
### By Voice
|
||||
coming soon
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ from examples.andriod_assistant.actions.screenshot_parse import ScreenshotParse
|
|||
from examples.andriod_assistant.actions.self_learn_and_reflect import (
|
||||
SelfLearnAndReflect,
|
||||
)
|
||||
from examples.andriod_assistant.utils.const import ROOT_PATH
|
||||
from examples.andriod_assistant.utils.schema import AndroidActionOutput, RunState
|
||||
from metagpt.actions.add_requirement import UserRequirement
|
||||
from metagpt.config2 import config
|
||||
|
|
@ -40,8 +41,7 @@ class AndroidAssistant(Role):
|
|||
self._watch([UserRequirement, AndroidActionOutput])
|
||||
self.task_desc = config.get_other("task_desc", "Just explore any app in this phone!")
|
||||
app_name = config.get_other("app_name", "demo")
|
||||
curr_path = Path(__file__).parent
|
||||
data_dir = curr_path.joinpath("..", "output")
|
||||
data_dir = ROOT_PATH.joinpath("output")
|
||||
cur_datetime = datetime.fromtimestamp(int(time.time())).strftime("%Y-%m-%d_%H-%M-%S")
|
||||
|
||||
"""Firstly, we decide the state with user config, further, we can do it automatically, like if it's new app,
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
import ast
|
||||
import asyncio
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from examples.andriod_assistant.actions.parse_record_an import RECORD_PARSE_NODE
|
||||
from examples.andriod_assistant.prompts.operation_prompt import (
|
||||
|
|
@ -15,17 +14,19 @@ from examples.andriod_assistant.prompts.operation_prompt import (
|
|||
tap_doc_template,
|
||||
text_doc_template,
|
||||
)
|
||||
from examples.andriod_assistant.utils.const import ROOT_PATH
|
||||
from examples.andriod_assistant.utils.schema import ActionOp, SwipeOp
|
||||
from metagpt.actions.action import Action
|
||||
from metagpt.config2 import config
|
||||
from metagpt.logs import logger
|
||||
from metagpt.utils.common import encode_image
|
||||
|
||||
TEST_BEFORE_PATH = Path("apps/demo_Contacts/labeled_screenshots/demo_Contacts_2024-01-30_21-50-19_1.png")
|
||||
TEST_AFTER_PATH = Path("apps/demo_Contacts/labeled_screenshots/demo_Contacts_2024-01-30_21-50-19_2.png")
|
||||
RECORD_PATH = Path("apps/demo_Contacts/record.txt")
|
||||
TASK_DESC_PATH = Path("apps/demo_Contacts/task_desc.txt")
|
||||
DOCS_DIR = Path("storage")
|
||||
TASK_PATH = ROOT_PATH.parent.joinpath("data/demo_Contacts")
|
||||
TEST_BEFORE_PATH = TASK_PATH.joinpath("labeled_screenshots/demo_Contacts_2024-01-24_12-07-55_3.png")
|
||||
TEST_AFTER_PATH = TASK_PATH.joinpath("labeled_screenshots/demo_Contacts_2024-01-24_12-07-55_4.png")
|
||||
RECORD_PATH = TASK_PATH.joinpath("record.txt")
|
||||
TASK_DESC_PATH = TASK_PATH.joinpath("task_desc.txt")
|
||||
DOCS_DIR = TASK_PATH.joinpath("storage")
|
||||
|
||||
testaction = Action(name="test")
|
||||
|
||||
|
|
|
|||
|
|
@ -12,35 +12,41 @@ from examples.andriod_assistant.actions.screenshot_parse import ScreenshotParse
|
|||
from examples.andriod_assistant.actions.self_learn_and_reflect import (
|
||||
SelfLearnAndReflect,
|
||||
)
|
||||
from examples.andriod_assistant.utils.const import ROOT_PATH
|
||||
from metagpt.environment.android_env.android_env import AndroidEnv
|
||||
|
||||
TASK_PATH = Path("apps/Contacts")
|
||||
TASK_PATH = ROOT_PATH.joinpath("unitest_Contacts")
|
||||
DEMO_NAME = str(time.time())
|
||||
SELF_EXPLORE_DOC_PATH = TASK_PATH.joinpath("autodocs")
|
||||
PARSE_RECORD_DOC_PATH = TASK_PATH.joinpath("demodocs")
|
||||
SELF_EXPLORE_DOC_PATH = TASK_PATH.joinpath("auto_docs")
|
||||
PARSE_RECORD_DOC_PATH = TASK_PATH.joinpath("demo_docs")
|
||||
|
||||
device_id = "emulator-5554"
|
||||
xml_dir = Path("/sdcard")
|
||||
screenshot_dir = Path("/sdcard/Pictures/Screenshots")
|
||||
|
||||
test_env_self_learn_android = AndroidEnv(
|
||||
device_id="emulator-5554",
|
||||
xml_dir=Path("/sdcard"),
|
||||
screenshot_dir=Path("/sdcard/Pictures/Screenshots"),
|
||||
device_id=device_id,
|
||||
xml_dir=xml_dir,
|
||||
screenshot_dir=screenshot_dir,
|
||||
)
|
||||
test_self_learning = SelfLearnAndReflect()
|
||||
|
||||
test_env_manual_learn_android = AndroidEnv(
|
||||
device_id="emulator-5554",
|
||||
xml_dir=Path("/sdcard"),
|
||||
screenshot_dir=Path("/sdcard/Pictures/Screenshots"),
|
||||
device_id=device_id,
|
||||
xml_dir=xml_dir,
|
||||
screenshot_dir=screenshot_dir,
|
||||
)
|
||||
test_manual_record = ManualRecord()
|
||||
test_manual_parse = ParseRecord()
|
||||
|
||||
test_env_screenshot_parse_android = AndroidEnv(
|
||||
device_id="emulator-5554",
|
||||
xml_dir=Path("/sdcard"),
|
||||
screenshot_dir=Path("/sdcard/Pictures/Screenshots"),
|
||||
device_id=device_id,
|
||||
xml_dir=xml_dir,
|
||||
screenshot_dir=screenshot_dir,
|
||||
)
|
||||
test_screenshot_parse = ScreenshotParse()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
loop = asyncio.get_event_loop()
|
||||
|
||||
|
|
|
|||
|
|
@ -2,4 +2,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# @Desc :
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
ROOT_PATH = Path(__file__).parent.parent.absolute()
|
||||
ADB_EXEC_FAIL = "FAILED"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue