fix adb multiline input

This commit is contained in:
liuyongbin
2025-12-16 14:14:46 +08:00
parent b873c32917
commit 707b7f43f8
2 changed files with 9 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
default_install_hook_types: default_install_hook_types:
- pre-commit - pre-commit
- commit-msg - commit-msg
exclude: '^phone_agent/config/apps\.py$'
default_stages: default_stages:
- pre-commit # Run locally - pre-commit # Run locally
repos: repos:
@@ -19,4 +19,4 @@ repos:
rev: v0.9.29 rev: v0.9.29
hooks: hooks:
- id: pymarkdown - id: pymarkdown
args: [fix] args: [fix]

View File

@@ -283,7 +283,13 @@ def parse_action(response: str) -> dict[str, Any]:
""" """
try: try:
response = response.strip() response = response.strip()
if response.startswith("do"): if response.startswith('do(action="Type"') or response.startswith(
'do(action="Type_Name"'
):
text = response.split("text=", 1)[1][1:-2]
action = {"_metadata": "do", "action": "Type", "text": text}
return action
elif response.startswith("do"):
# Use AST parsing instead of eval for safety # Use AST parsing instead of eval for safety
try: try:
tree = ast.parse(response, mode="eval") tree = ast.parse(response, mode="eval")