test: add pytest verification suite and gitea ci workflow
All checks were successful
CI / test (push) Successful in 48s
All checks were successful
CI / test (push) Successful in 48s
This commit is contained in:
14
src/agent.py
14
src/agent.py
@@ -18,9 +18,10 @@ from .utils import clamp, draw_global_grid, image_to_data_url, utc_now_iso
|
||||
try:
|
||||
import pyautogui
|
||||
except Exception as import_exc:
|
||||
raise RuntimeError(
|
||||
"pyautogui is required. Install dependencies with: pip install pyautogui pillow"
|
||||
) from import_exc
|
||||
pyautogui = None # type: ignore[assignment]
|
||||
_PYAUTOGUI_IMPORT_ERROR = import_exc
|
||||
else:
|
||||
_PYAUTOGUI_IMPORT_ERROR = None
|
||||
|
||||
|
||||
SYSTEM_PROMPT = """
|
||||
@@ -52,6 +53,12 @@ class ScreenJobAgent:
|
||||
cancel_event: threading.Event | None = None,
|
||||
event_callback: Callable[[dict[str, Any]], None] | None = None,
|
||||
) -> None:
|
||||
if pyautogui is None:
|
||||
raise RuntimeError(
|
||||
"pyautogui is required for agent execution. "
|
||||
"Install dependencies and ensure GUI access. "
|
||||
f"Import error: {_PYAUTOGUI_IMPORT_ERROR}"
|
||||
)
|
||||
self.client = client
|
||||
self.logger = logger
|
||||
self.artifacts = artifacts
|
||||
@@ -784,4 +791,3 @@ class ScreenJobAgent:
|
||||
usage=self.usage,
|
||||
error=result_text,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user