mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 12:18:44 +00:00
fix(agent): prevent redundant final video chunks in embedding workflow
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user