feat: add page-level followups for main agent landings

This commit is contained in:
kris
2026-03-29 22:42:38 +08:00
parent e65e32e5a8
commit 6c9b45ab37
2 changed files with 56 additions and 0 deletions

View File

@@ -4471,6 +4471,57 @@ function captureMainAgentLandingContext(action, targetScreen) {
};
}
function renderMainAgentLandingQuickActions(screenKey) {
const actionMap = {
intake: [
{ action: "create-project", label: "新建项目" },
{ action: "open-import-video-link", label: "导入作品" },
{ action: "open-upload-video", label: "上传视频" }
],
discovery: [
{ action: "open-import-homepage", label: "导入主页" },
{ action: "analyze-top-videos", label: "高分分析" },
{ action: "goto-tracking", label: "去跟踪账号" }
],
tracking: [
{ action: "refresh-tracking", label: "同步全部" },
{ action: "mark-tracking-read", label: "标记已读" },
{ action: "goto-discovery", label: "跳到找对标" }
],
automation: [
{ action: "refresh-data", label: "刷新状态" },
{ action: "goto-production", label: "去生产中心" }
],
playbook: [
{ action: "open-oneliner-profile", label: "配置 OneLiner" },
{ action: "open-create-assistant", label: "新建 Agent" },
{ action: "goto-production", label: "去生产中心" }
],
production: [
{ action: "goto-review", label: "去复盘" },
{ action: "batch-recover-jobs", label: "批量恢复" },
{ action: "refresh-data", label: "刷新队列" }
],
review: [
{ action: "open-create-review", label: "写复盘" },
{ action: "goto-production", label: "去生产中心" },
{ action: "refresh-data", label: "刷新结果" }
],
strategy: [
{ action: "open-user-global-policy", label: "编辑全局策略" },
{ action: "open-user-platform-policy", label: "编辑当前平台策略" },
{ action: "open-oneliner-profile", label: "调整 OneLiner" }
]
};
const actions = safeArray(actionMap[screenKey]).slice(0, 3);
if (!actions.length) return "";
return `
<div class="task-meta" style="margin-top:10px;">
${actions.map((item) => `<span class="tag clickable-tag" data-action="${escapeHtml(item.action)}">${escapeHtml(item.label)}</span>`).join("")}
</div>
`;
}
function renderMainAgentLandingNotice(screenKey) {
const landing = appState.mainAgentLanding;
if (!landing || landing.screen !== screenKey) return "";
@@ -4494,6 +4545,7 @@ function renderMainAgentLandingNotice(screenKey) {
`).join("")}
</div>
` : ""}
${renderMainAgentLandingQuickActions(screenKey)}
<div class="task-meta">
${landing.title ? `<span class="tag blue">${escapeHtml(landing.title)}</span>` : ""}
${resultSections.workstream_label ? `<span class="tag">${escapeHtml(resultSections.workstream_label)}</span>` : ""}

View File

@@ -260,6 +260,7 @@ test("main agent result rendering offers a direct route back into the recommende
test("main agent route actions keep landing context and destination screens render a notice", () => {
const execution = extractBetween(APP, "function renderOneLinerExecutionPayloadHtml(payload)", "function parseOneLinerActionPayloadValue(value)");
const actions = extractBetween(APP, "document.addEventListener(\"click\", async (event) => {", "document.addEventListener(\"submit\", async (event) => {");
const landingActions = extractBetween(APP, "function renderMainAgentLandingQuickActions(screenKey)", "function renderMainAgentLandingNotice(screenKey)");
const strategy = extractBetween(APP, "function renderStrategyScreen()", "function renderCreditsScreen()");
const landing = extractBetween(APP, "function renderMainAgentLandingNotice(screenKey)", "function renderEmptyState(title, description)");
const production = extractBetween(APP, "function renderProductionScreen()", "function renderReviewScreen()");
@@ -267,7 +268,10 @@ test("main agent route actions keep landing context and destination screens rend
assert.match(actions, /captureMainAgentLandingContext\(action,\s*"goto-production"/);
assert.match(actions, /captureMainAgentLandingContext\(action,\s*"goto-strategy"/);
assert.match(actions, /name === "dismiss-main-agent-landing"/);
assert.match(landingActions, /open-user-global-policy/);
assert.match(landingActions, /refresh-tracking/);
assert.match(landing, /result_sections/);
assert.match(landing, /renderMainAgentLandingQuickActions\(screenKey\)/);
assert.match(landing, /detail-grid/);
assert.match(strategy, /renderMainAgentLandingNotice\("strategy"\)/);
assert.match(production, /renderMainAgentLandingNotice\("production"\)/);