mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-25 10:28:01 +00:00
feat(agent): implement overlapping video chunks for semantic search and update docs
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user