fix: skip creator-fields fetch without creator snapshot
This commit is contained in:
@@ -1595,7 +1595,7 @@ async function loadPlatformAccount(platform, accountId, requestToken = 0) {
|
||||
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, creatorFieldsPayload, analysisReportsPayload] = await Promise.all([
|
||||
const [workspace, videos, snapshotsPayload, analysisReportsPayload] = await Promise.all([
|
||||
storyforgeFetch(workspacePath),
|
||||
supportsAccountVideos
|
||||
? storyforgeFetch(videosPath).catch(() => ({
|
||||
@@ -1615,9 +1615,6 @@ async function loadPlatformAccount(platform, accountId, requestToken = 0) {
|
||||
supportsAccountSnapshots
|
||||
? storyforgeFetch(`/v2/douyin/accounts/${encodeURIComponent(accountId)}/snapshots`).catch(() => [])
|
||||
: Promise.resolve([]),
|
||||
supportsCreatorFields
|
||||
? storyforgeFetch(`/v2/douyin/accounts/${encodeURIComponent(accountId)}/creator-fields`).catch(() => null)
|
||||
: Promise.resolve(null),
|
||||
supportsAnalysisReports
|
||||
? storyforgeFetch(`/v2/douyin/accounts/${encodeURIComponent(accountId)}/analysis-reports`).catch(() => [])
|
||||
: Promise.resolve([])
|
||||
@@ -1629,7 +1626,9 @@ async function loadPlatformAccount(platform, accountId, requestToken = 0) {
|
||||
appState.selectedVideos = videos;
|
||||
if (normalizedPlatform === "douyin") {
|
||||
appState.snapshots = safeArray(snapshotsPayload?.items || snapshotsPayload);
|
||||
appState.creatorFields = creatorFieldsPayload;
|
||||
appState.creatorFields = supportsCreatorFields && hasCreatorCenterSnapshot(appState.snapshots)
|
||||
? await storyforgeFetch(`/v2/douyin/accounts/${encodeURIComponent(accountId)}/creator-fields`).catch(() => null)
|
||||
: null;
|
||||
appState.analysisReports = safeArray(analysisReportsPayload?.items || analysisReportsPayload);
|
||||
const nextSnapshotId = appState.snapshots.find((item) => item.id === appState.selectedSnapshotId)?.id || appState.snapshots[0]?.id || "";
|
||||
appState.selectedSnapshotId = nextSnapshotId;
|
||||
@@ -2115,6 +2114,10 @@ function getDashboardActionSourceLabel() {
|
||||
return appState.onelinerProfile ? "主 Agent 优先推荐" : "规则推荐";
|
||||
}
|
||||
|
||||
function hasCreatorCenterSnapshot(items) {
|
||||
return safeArray(items).some((item) => String(item?.snapshot_type || "").toLowerCase() === "creator_center");
|
||||
}
|
||||
|
||||
function getDashboardProjectProgressSummary(project, stats, trackedAccounts) {
|
||||
const total = 5;
|
||||
const completed = [
|
||||
|
||||
Reference in New Issue
Block a user