feat: add favorite task templates and optimize evidence exports
This commit is contained in:
1 parent
e1ea099592
commit
a4a5430922
46 files changed
+1714
-188
No files matched your search
@@ -0,0 +1,53 @@
|
||||
"""Credential-free execution settings persisted for repeatable favorites."""
|
||||
|
||||
from apps.admin_console.services.task_import import TaskOptions
|
||||
from artemis.config import load_agent_config, parse_llm_config, verification_level_for_checker
|
||||
from artemis.config.settings import settings
|
||||
|
||||
|
||||
def execution_config(item: dict) -> dict:
|
||||
agent = load_agent_config()
|
||||
model = parse_llm_config().operator
|
||||
options = {
|
||||
"profile": item.get("profile") or "flash",
|
||||
"model": model.model,
|
||||
"reasoning_effort": model.reasoning_effort or "default",
|
||||
"request_timeout_seconds": model.timeout,
|
||||
"max_retries": model.max_retries,
|
||||
"retry_interval_seconds": settings.OPENAI_RETRY_INTERVAL_SECONDS,
|
||||
"record_video": settings.ARTEMIS_RECORDING_ENABLED,
|
||||
"recording": agent.recording.model_dump(),
|
||||
"analyze_video": agent.video_analyzer.enable_ledger,
|
||||
"timeout_seconds": settings.ARTEMIS_TASK_TIMEOUT_SECONDS,
|
||||
"verification_level": verification_level_for_checker(agent.checker),
|
||||
"explorer_mode": agent.explorer.resolve(profile=item.get("profile") or "flash"),
|
||||
"observation_timeout_seconds": settings.ARTEMIS_OBSERVATION_TIMEOUT_SECONDS,
|
||||
"observation_max_attempts": settings.ARTEMIS_OBSERVATION_MAX_ATTEMPTS,
|
||||
"device_command_timeout_seconds": settings.ARTEMIS_DEVICE_COMMAND_TIMEOUT_SECONDS,
|
||||
"action_failure_attempts": settings.ARTEMIS_ACTION_FAILURE_ATTEMPTS,
|
||||
"worker_cleanup_timeout_seconds": settings.ARTEMIS_WORKER_CLEANUP_TIMEOUT_SECONDS,
|
||||
}
|
||||
for key in ("device_serial", "verification_level", "explorer_mode", "locked_app_package"):
|
||||
if item.get(key) is not None:
|
||||
options[key] = item[key]
|
||||
overrides = item.get("runtime_overrides") or {}
|
||||
options["recording"] = {**options["recording"], **(overrides.get("recording") or {})}
|
||||
options.update({k: v for k, v in overrides.items() if k != "recording" and v is not None})
|
||||
return {
|
||||
"runtime_overrides": TaskOptions.model_validate(options).model_dump(exclude_none=True),
|
||||
"expected_output": item.get("expected_output"),
|
||||
"enable_outputter": item.get("enable_outputter")
|
||||
if item.get("enable_outputter") is not None
|
||||
else agent.outputter.enabled,
|
||||
"app_path": item.get("app_path"),
|
||||
}
|
||||
|
||||
|
||||
def persist_execution_config(item: dict) -> None:
|
||||
from apps.admin_console.services.automation_store import store
|
||||
|
||||
snapshot = execution_config(item)
|
||||
item["execution_config"] = snapshot
|
||||
if job := store.job(str(item["session_id"])):
|
||||
job["execution_config"] = snapshot
|
||||
store.save_job(job)
|
||||
Reference in new issue
Block a user