fix(agent): prevent redundant final video chunks in embedding workflow

This commit is contained in:
yiling
2026-06-18 19:57:01 +08:00
parent 718d9d5b51
commit a197c83580
2 changed files with 44 additions and 1 deletions
@@ -154,7 +154,9 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
for (let start = 0.0; start < duration; start += step) {
let end = start + limit
if (end > duration) end = duration
if (end >= duration) {
end = duration
}
// Step A: Slice chunk on transcode worker and upload to S3
const chunkRes = await executeActivity(transcodeWorkerQueue, transcodeVideoChunkActivity, {
@@ -192,6 +194,11 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
key: chunkKey,
})
}
// If this chunk reached the end of the video, stop to avoid redundant overlapping chunks
if (end >= duration) {
break
}
}
}