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