Preserve FunClip handoff source
Some checks failed
CI / main (push) Has been cancelled
CI / release-e2e (push) Has been cancelled

This commit is contained in:
2026-07-07 09:41:05 +08:00
parent 38bba0828c
commit 4f1815dd16

View File

@@ -9782,14 +9782,24 @@ function FunClipEditingPage({
const timelineHandoffSource = useMemo<ClipSource | null>(() => { const timelineHandoffSource = useMemo<ClipSource | null>(() => {
const asset = timelineHandoff?.asset; const asset = timelineHandoff?.asset;
const url = publishableAssetMediaUrl(asset); if (!asset || asset.type !== 'video') {
if (!asset || (asset.type !== 'video' && asset.type !== 'audio') || !url) { return null;
}
const videoAsset = {
type: asset.type,
name: asset.name || '数字人成片',
url: asset.url || '',
thumbnailUrl: asset.thumbnailUrl || '',
localPath: asset.localPath || '',
};
const url = publishableAssetMediaUrl(videoAsset);
if (!url) {
return null; return null;
} }
return { return {
id: `handoff-${asset.assetId || asset.id || 'media'}`, id: `handoff-${asset.assetId || asset.id || 'media'}`,
assetId: asset.assetId || asset.id, assetId: asset.assetId || asset.id,
name: asset.name || '数字人成片', name: videoAsset.name,
type: asset.type, type: asset.type,
source: 'asset-center', source: 'asset-center',
section: 'work', section: 'work',
@@ -9802,7 +9812,7 @@ function FunClipEditingPage({
), ),
provider: asset.provider || '数字人', provider: asset.provider || '数字人',
url, url,
thumbnailUrl: publishableAssetThumbnailUrl(asset), thumbnailUrl: publishableAssetThumbnailUrl(videoAsset),
localPath: asset.localPath, localPath: asset.localPath,
durationMs: asset.durationMs, durationMs: asset.durationMs,
width: asset.width, width: asset.width,
@@ -9810,6 +9820,8 @@ function FunClipEditingPage({
createdAt: asset.createdAt || timelineHandoff.createdAt || Date.now(), createdAt: asset.createdAt || timelineHandoff.createdAt || Date.now(),
}; };
}, [timelineHandoff]); }, [timelineHandoff]);
const [retainedHandoffSource, setRetainedHandoffSource] =
useState<ClipSource | null>(null);
const sourceOptions = useMemo<ClipSource[]>(() => { const sourceOptions = useMemo<ClipSource[]>(() => {
const materialSources = assets const materialSources = assets
@@ -9861,11 +9873,11 @@ function FunClipEditingPage({
}; };
}); });
const seen = new Set<string>(); const seen = new Set<string>();
return [ const handoffSources = [
...(timelineHandoffSource ? [timelineHandoffSource] : []), timelineHandoffSource,
...finishedSources, retainedHandoffSource,
...materialSources, ].filter((item): item is ClipSource => Boolean(item));
] return [...finishedSources, ...materialSources, ...handoffSources]
.filter((item) => { .filter((item) => {
const key = item.assetId || item.localPath || item.url || item.id; const key = item.assetId || item.localPath || item.url || item.id;
if (seen.has(key)) { if (seen.has(key)) {
@@ -9875,7 +9887,7 @@ function FunClipEditingPage({
return true; return true;
}) })
.sort((a, b) => b.createdAt - a.createdAt); .sort((a, b) => b.createdAt - a.createdAt);
}, [assets, finishedAssets, timelineHandoffSource]); }, [assets, finishedAssets, retainedHandoffSource, timelineHandoffSource]);
const clipPresets: Array<{ const clipPresets: Array<{
id: ClipPresetId; id: ClipPresetId;
@@ -10425,6 +10437,9 @@ function FunClipEditingPage({
} }
return false; return false;
} }
if (detail.intent === 'digital-human-polish' && match.id.startsWith('handoff-')) {
setRetainedHandoffSource(match);
}
setSelectedSourceId(match.id); setSelectedSourceId(match.id);
setSourceTab('asset-center'); setSourceTab('asset-center');
setSourceFilter(match.type); setSourceFilter(match.type);