fix: _videoFrames 改用 allVids 总帧数,修复多个视频时指示牌不显示

This commit is contained in:
thzxx
2026-06-18 13:23:10 +08:00
parent 96bf48aaf5
commit 0aa33d590c
+5 -4
View File
@@ -1002,8 +1002,8 @@ async function sendMessageWithAgentLoop(text: string, currentSession: ChatSessio
const displayContent = displayParts.join('\n'); const displayContent = displayParts.join('\n');
// Ollama API 用的完整描述(视频带帧序列) // Ollama API 用的完整描述(视频带帧序列)
let allVids: Array<{ name: string; count: number; dur: number; frames: Array<{ timestampSeconds: number; name: string }> }> = [];
if (hasVideos) { if (hasVideos) {
const allVids: Array<{ name: string; count: number; dur: number; frames: Array<{ timestampSeconds: number; name: string }> }> = [];
if (pendingVideoMeta && pendingVideoFrames.length > 0) { if (pendingVideoMeta && pendingVideoFrames.length > 0) {
allVids.push({ name: pendingVideoMeta.fileName, count: pendingVideoFrames.length, dur: pendingVideoMeta.duration, frames: pendingVideoFrames }); allVids.push({ name: pendingVideoMeta.fileName, count: pendingVideoFrames.length, dur: pendingVideoMeta.duration, frames: pendingVideoFrames });
} }
@@ -1029,9 +1029,10 @@ async function sendMessageWithAgentLoop(text: string, currentSession: ChatSessio
images: [...pendingImages.map(img => img.base64)], images: [...pendingImages.map(img => img.base64)],
timestamp: now timestamp: now
}; };
if (pendingVideoFrames.length > 0 && pendingVideoMeta) { if (allVids.length > 0) {
msg._videoFrames = [...pendingVideoFrames]; const totalFrames = allVids.flatMap(v => v.frames);
msg._videoMeta = { ...pendingVideoMeta, frameCount: pendingVideoFrames.length }; msg._videoFrames = totalFrames;
msg._videoMeta = { fileName: allVids[0].name, duration: allVids[0].dur, frameCount: totalFrames.length };
} }
if (userFiles.length > 0) { if (userFiles.length > 0) {
msg.files = userFiles; msg.files = userFiles;