feat(agent): implement overlapping video chunks for semantic search and update docs

This commit is contained in:
yiling
2026-06-18 19:45:58 +08:00
parent 570d95fa6f
commit eaf2c867b3
6 changed files with 31 additions and 23 deletions
@@ -71,7 +71,7 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const { asset, chunkDuration } = context as any
const { asset, chunkDuration, chunkOverlap } = context as any
const isImage = asset.mediaType?.startsWith('image/')
const isVideo = asset.mediaType?.startsWith('video/')
@@ -149,8 +149,10 @@ export async function agentEmbeddingMedia(task: WorkflowTask): Promise<void> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const duration = (asset.media as any)?.duration || 0
const limit = chunkDuration || 60.0
const overlap = chunkOverlap ?? 5.0
const step = Math.max(1, limit - overlap)
for (let start = 0.0; start < duration; start += limit) {
for (let start = 0.0; start < duration; start += step) {
let end = start + limit
if (end > duration) end = duration