diff --git a/src/features/production/components/ShotProductionAssets.vue b/src/features/production/components/ShotProductionAssets.vue index 5d56600..858550c 100644 --- a/src/features/production/components/ShotProductionAssets.vue +++ b/src/features/production/components/ShotProductionAssets.vue @@ -57,8 +57,23 @@ const props = defineProps<{ }>() const emit = defineEmits<{ changed: [] }>() const key = computed(() => props.shot.shotId) -/** 单镜头资产已有刷新入口,不再定时轮询。 */ -const query = usePolling( +/** 仅当前镜头存在后台首帧或视频任务时临时轮询,终态后自动停止。 */ +let query!: ReturnType> + videos: Awaited> + qualityStatus: Awaited> | null + qualityStatusError: string + inputPlan: Awaited> | null + inputPlanError: string +}>> +const assetPollInterval = computed(() => { + const data = query?.data.value + if (!data) return false + const keyframeRunning = data.keyframes.some(item => ['pending', 'generating'].includes(item.status)) + const videoRunning = data.videos.some(isActiveVideo) + return keyframeRunning || videoRunning ? 5000 : false +}) +query = usePolling( key, async (shotId, signal) => { const [keyframes, videos, qualityState, inputPlanState] = await Promise.all([ @@ -86,7 +101,7 @@ const query = usePolling( inputPlanError: inputPlanState.error } }, - false + assetPollInterval ) /** 单独读取已保存的提示词,查询失败不影响首帧和视频资产展示。 */ const promptQuery = usePolling(key, (shotId, signal) => storyboardApi.videoPrompt(shotId, signal), false)