fix: improve filmstrip picking and audio retry

This commit is contained in:
2026-05-19 20:01:45 +08:00
parent fe60d5dc99
commit aabddef486
5 changed files with 74 additions and 18 deletions

View File

@@ -60,6 +60,11 @@ const DEFAULT_PRODUCT_LIBRARY_IDS = [
]
const VIDEO_READY_STATUSES: Job["status"][] = ["downloaded", "frames_extracted", "transcribed", "failed"]
function isAudioProcessing(job?: Job | null) {
if (!job) return false
return job.audio_script?.status === "rewriting" || (job.status === "transcribing" && job.audio_script?.status !== "failed")
}
const PRODUCT_FUSION_WEARING_PROMPT = [
"Product placement must be physically correct:",
"The SKG device is a rigid opaque white U-shaped neck massager, not a soft scarf, necklace, cable, collar, sticker, implant, or transparent body part.",
@@ -448,7 +453,7 @@ export default function Home() {
if (!options?.silent) toast.info("视频导入完成后,可在音频卡片点击提取音频")
return
}
if (target.status === "transcribing" || target.audio_script?.status === "rewriting") {
if (isAudioProcessing(target)) {
if (!options?.silent) toast.info("音频正在处理中")
return
}
@@ -466,8 +471,9 @@ export default function Home() {
if (!videoReady) return
const audioKey = `${target.id}:audio`
const hasAudioResult = !!target.audio_script?.source_text || target.transcript.length > 0
const audioRunning = target.status === "transcribing" || target.audio_script?.status === "rewriting"
const audioFailed = target.audio_script?.status === "failed"
const hasAudioResult = !audioFailed && (!!target.audio_script?.source_text || target.transcript.length > 0)
const audioRunning = isAudioProcessing(target)
if (!hasAudioResult && !audioRunning && !autoTriggeredRef.current.has(audioKey)) {
autoTriggeredRef.current.add(audioKey)
try {