feat: release 2.4.0 with original cases and automatic human review
This commit is contained in:
1 parent
baf069854b
commit
4dc2057d43
66 files changed
+1390
-206
No files matched your search
@@ -9,6 +9,7 @@ from apps.admin_console.services.automation_store import AutomationStore, identi
|
||||
from apps.admin_console.database.repositories.session_repository import SessionRepository
|
||||
from artemis.plugins.models import PluginManifest
|
||||
from artemis.plugins.store import PluginStore
|
||||
from apps.admin_console.services.task_import import case_title
|
||||
|
||||
TERMINAL = {"completed", "success", "failed", "cancelled", "interrupted", "skipped"}
|
||||
|
||||
@@ -41,10 +42,26 @@ def task_context(session_id: str, store: AutomationStore) -> dict:
|
||||
job = store.job(session_id) or {}
|
||||
if not session and not job:
|
||||
raise ValueError("任务记录不存在")
|
||||
case = job.get("case") or {}
|
||||
navigation = None
|
||||
if batch_id := job.get("batch_id"):
|
||||
jobs = [item for item in store.jobs(batch_id) if item.get("status") in TERMINAL]
|
||||
ids = [item["session_id"] for item in jobs]
|
||||
index = ids.index(session_id) if session_id in ids else -1
|
||||
navigation = {
|
||||
"scope": "batch",
|
||||
"position": index + 1,
|
||||
"total": len(ids),
|
||||
"previous": ids[index - 1] if index > 0 else None,
|
||||
"next": ids[index + 1] if 0 <= index < len(ids) - 1 else None,
|
||||
}
|
||||
return {
|
||||
"session_id": session_id,
|
||||
"initial_prompt": session.get("initial_goal") or (job.get("case") or {}).get("goal", ""),
|
||||
"editable": (job.get("status") or session.get("status")) in TERMINAL,
|
||||
"case_title": case_title(case),
|
||||
"original_case": case.get("original_case"),
|
||||
"navigation": navigation,
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user