feat: direct-execute review entry when context exists
This commit is contained in:
@@ -3043,6 +3043,15 @@ function getCompletedJobOptions() {
|
||||
}));
|
||||
}
|
||||
|
||||
function getLatestCompletedProjectJob() {
|
||||
const projectId = appState.selectedProjectId || "";
|
||||
return safeArray(appState.dashboard?.recent_jobs).find((item) => {
|
||||
if (item.status !== "completed") return false;
|
||||
if (!projectId) return true;
|
||||
return String(item.project_id || "") === projectId;
|
||||
}) || null;
|
||||
}
|
||||
|
||||
function getProjectStats(projectId) {
|
||||
const dashboard = appState.dashboard || {};
|
||||
const knowledgeBases = safeArray(dashboard.knowledge_bases).filter((item) => item.project_id === projectId);
|
||||
@@ -12381,6 +12390,15 @@ document.addEventListener("click", async (event) => {
|
||||
return;
|
||||
}
|
||||
if (name === "open-create-review") {
|
||||
const fallbackJob = getLatestCompletedProjectJob();
|
||||
if (fallbackJob?.id) {
|
||||
await runDirectWorkbenchAction("review-draft", {
|
||||
busyLabel: "正在生成复盘草稿...",
|
||||
errorTitle: "生成复盘草稿失败",
|
||||
payload: { source_job_id: fallbackJob.id }
|
||||
});
|
||||
return;
|
||||
}
|
||||
openReviewAction();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1027,9 +1027,13 @@ test("main agent landing quick actions prefer direct execute flows where executo
|
||||
test("playbook and review high-frequency actions now reuse direct execute handlers", () => {
|
||||
const playbook = extractBetween(APP, "function renderPlaybookScreen()", "function renderProductionScreen()");
|
||||
const review = extractBetween(APP, "function renderReviewScreen()", "function renderStrategyScreen()");
|
||||
const clickActions = extractBetween(APP, "document.addEventListener(\"click\", async (event) => {", "document.addEventListener(\"submit\", async (event) => {");
|
||||
assert.match(playbook, /direct-create-assistant/);
|
||||
assert.match(review, /direct-review-draft/);
|
||||
assert.match(APP, /payload: action\.dataset\.jobId \? \{ source_job_id: action\.dataset\.jobId \} : \{\}/);
|
||||
assert.match(clickActions, /name === "open-create-review"[\s\S]*const fallbackJob = getLatestCompletedProjectJob\(\)/);
|
||||
assert.match(clickActions, /name === "open-create-review"[\s\S]*runDirectWorkbenchAction\("review-draft"/);
|
||||
assert.match(clickActions, /name === "open-create-review"[\s\S]*openReviewAction\(\)/);
|
||||
});
|
||||
|
||||
test("main agent landing notices expose a compact mobile follow-up strip", () => {
|
||||
|
||||
Reference in New Issue
Block a user