feat: add prompt-first batches and pausable task guidance
This commit is contained in:
1 parent
cec9898e4c
commit
057f0c3050
44 files changed
+1080
-191
No files matched your search
@@ -37,6 +37,7 @@ from artemis.agents.explorer.tiers import SUBMIT_TOOL
|
||||
from artemis.agents.explorer.tool_declarations import UNIVERSAL_EXPLORER_TOOLS
|
||||
from artemis.graph.state import State
|
||||
from artemis.services.llm import get_llm
|
||||
from artemis.config.settings import settings
|
||||
from artemis.utils.logger import get_logger
|
||||
|
||||
logger = get_logger(__name__)
|
||||
@@ -120,7 +121,9 @@ class UniversalRunnerMixin:
|
||||
else:
|
||||
current_llm = bound_llm
|
||||
|
||||
response = await asyncio.wait_for(current_llm.ainvoke(messages), timeout=180)
|
||||
response = await asyncio.wait_for(
|
||||
current_llm.ainvoke(messages), timeout=settings.OPENAI_TIMEOUT_SECONDS
|
||||
)
|
||||
messages.append(response)
|
||||
|
||||
tool_calls = getattr(response, "tool_calls", None) or []
|
||||
|
||||
@@ -37,7 +37,6 @@ active window until its turn is chunked, whose user lines then carry it on.
|
||||
"""
|
||||
|
||||
import asyncio
|
||||
from artemis.config.settings import settings
|
||||
import base64
|
||||
from dataclasses import dataclass, field
|
||||
import json
|
||||
@@ -45,6 +44,9 @@ from pathlib import Path
|
||||
import re
|
||||
import uuid
|
||||
|
||||
from artemis.config.settings import settings
|
||||
from artemis.runtime.task_control import TaskControl
|
||||
|
||||
from jinja2 import Template
|
||||
from langchain_core.messages import (
|
||||
BaseMessage,
|
||||
@@ -1060,6 +1062,25 @@ class FlashRunner:
|
||||
pending_notices: list[str] = []
|
||||
|
||||
while limit is None or turns < limit:
|
||||
control = getattr(self.ctx, "task_control", None)
|
||||
if isinstance(control, TaskControl):
|
||||
resumed = await control.checkpoint(
|
||||
on_pause=getattr(self.ctx, "on_task_pause", None),
|
||||
on_resume=getattr(self.ctx, "on_task_resume", None),
|
||||
)
|
||||
if resumed:
|
||||
(
|
||||
shot_path,
|
||||
current_pre_screenshot_bytes,
|
||||
current_xml_list,
|
||||
) = await capture_screenshot_and_parse_ui(
|
||||
self.ctx, state, self.controller, skip_settling=False
|
||||
)
|
||||
state.latest_screenshot = shot_path
|
||||
pending_notices.append(
|
||||
"设备在暂停期间可能被其他任务操作过。已重新观察画面;"
|
||||
"请根据当前状态和新指导重新判断操作,勿沿用旧坐标。"
|
||||
)
|
||||
turns += 1
|
||||
logger.info(f"--- Artemis Flash Turn {turns}{f'/{limit}' if limit else ''} ---")
|
||||
|
||||
|
||||
Reference in new issue
Block a user