fix: continue live-first workbench reads

This commit is contained in:
kris
2026-03-30 21:02:35 +08:00
parent f766fea2b9
commit 67bddcf4b3
2 changed files with 8 additions and 11 deletions

View File

@@ -2406,14 +2406,10 @@ async function loadPlatformAccount(platform, accountId, requestToken = 0) {
return true;
}
const videosPath = getWorkbenchRoute(normalizedPlatform, "videos", accountId);
const supportsAccountVideos = videosPath && backendSupports(`/v2/${normalizedPlatform}/accounts/{account_id}/videos`);
const supportsAccountSnapshots = normalizedPlatform === "douyin" && backendSupports("/v2/douyin/accounts/{account_id}/snapshots");
const supportsCreatorFields = normalizedPlatform === "douyin" && backendSupports("/v2/douyin/accounts/{account_id}/creator-fields");
const supportsAnalysisReports = normalizedPlatform === "douyin" && backendSupports("/v2/douyin/accounts/{account_id}/analysis-reports");
try {
const [workspace, videos, snapshotsPayload, analysisReportsPayload] = await Promise.all([
storyforgeFetch(workspacePath),
supportsAccountVideos
videosPath
? storyforgeFetch(videosPath).catch(() => ({
items: [],
meta: {},
@@ -2428,10 +2424,10 @@ async function loadPlatformAccount(platform, accountId, requestToken = 0) {
latest_video_ids: [],
high_score_threshold: 60
}),
supportsAccountSnapshots
normalizedPlatform === "douyin"
? storyforgeFetch(`/v2/douyin/accounts/${encodeURIComponent(accountId)}/snapshots`).catch(() => [])
: Promise.resolve([]),
supportsAnalysisReports
normalizedPlatform === "douyin"
? storyforgeFetch(`/v2/douyin/accounts/${encodeURIComponent(accountId)}/analysis-reports`).catch(() => [])
: Promise.resolve([])
]);
@@ -2442,7 +2438,7 @@ async function loadPlatformAccount(platform, accountId, requestToken = 0) {
appState.selectedVideos = videos;
if (normalizedPlatform === "douyin") {
appState.snapshots = safeArray(snapshotsPayload?.items || snapshotsPayload);
appState.creatorFields = supportsCreatorFields && hasCreatorCenterSnapshot(appState.snapshots)
appState.creatorFields = hasCreatorCenterSnapshot(appState.snapshots)
? await storyforgeFetch(`/v2/douyin/accounts/${encodeURIComponent(accountId)}/creator-fields`).catch(() => null)
: null;
appState.analysisReports = safeArray(analysisReportsPayload?.items || analysisReportsPayload);
@@ -9306,9 +9302,6 @@ async function openPlatformAgentDetailAction(platform) {
const skills = safeArray(skillsPayload?.items || skillsPayload).slice(0, 6);
const skillVersionEntries = await Promise.all(
skills.map(async (item) => {
if (!backendSupports("/v2/platform-agents/{platform}/skills/{skill_id}/versions")) {
return [item.id, []];
}
const payload = await storyforgeFetch(`/v2/platform-agents/${encodeURIComponent(normalizedPlatform)}/skills/${encodeURIComponent(item.id)}/versions?project_id=${encodeURIComponent(project.id)}`).catch(() => ({ items: [] }));
return [item.id, safeArray(payload?.items || payload).slice(0, 3)];
})

View File

@@ -292,11 +292,13 @@ test("quota and review screens foreground live next-step guidance", () => {
test("tracking refresh and top-video analysis flows expose async feedback inside the workbench", () => {
const tracking = extractBetween(APP, "function renderTrackingScreen()", "function renderAutomationScreen()");
const discovery = extractBetween(APP, "function renderDiscoveryOverviewSection(", "function renderDiscoveryRelationsSection(");
const accountWorkspaceLoad = extractBetween(APP, "async function loadPlatformAccount(", "async function bootstrap()");
const trackingActions = extractBetween(APP, "async function markTrackingDigestRead()", "function createEmptyTrackingDigest(");
const oneLinerSession = extractBetween(APP, "async function ensureOneLinerSession()", "async function submitOneLinerMessage(");
const oneLinerRun = extractBetween(APP, "async function createOneLinerRun(", "async function confirmOneLinerRun(");
const oneLinerAction = extractBetween(APP, "async function executeOneLinerAction(", "function openCurrentOneLinerRunResultAction(");
const skillReview = extractBetween(APP, "function openPlatformSkillReviewAction(", "function openPlatformSkillRollbackAction(");
const agentDetail = extractBetween(APP, "async function openPlatformAgentDetailAction(", "function openPlatformSkillReviewAction(");
const topVideoAction = extractBetween(APP, "function openAnalyzeTopVideosAction()", "function openSimilaritySearchAction()");
assert.match(APP, /function summarizeTrackingRefreshPayload\(/);
@@ -310,10 +312,12 @@ test("tracking refresh and top-video analysis flows expose async feedback inside
assert.match(discovery, /最近高分拆解/);
assert.match(discovery, /这批结果已经回流到当前账号页/);
assert.doesNotMatch(trackingActions, /.*|.*|.*/s);
assert.doesNotMatch(accountWorkspaceLoad, /supportsAccountVideos|supportsAccountSnapshots|supportsCreatorFields|supportsAnalysisReports/);
assert.doesNotMatch(oneLinerSession, /当前后端还没有接入 OneLiner 会话接口/);
assert.doesNotMatch(oneLinerRun, /当前后端还没有接入主 Agent 运行层/);
assert.doesNotMatch(oneLinerAction, /当前后端还没有接入 OneLiner 动作执行器/);
assert.doesNotMatch(skillReview, /当前后端还没有接入平台技能验收接口/);
assert.ok(!agentDetail.includes('backendSupports("/v2/platform-agents/{platform}/skills/{skill_id}/versions")'));
assert.doesNotMatch(topVideoAction, /.*/s);
assert.match(topVideoAction, /当前实例未提供/);
});