fix: 每个视频独立指示牌,不合并——_videos 数组逐个渲染
This commit is contained in:
@@ -183,11 +183,13 @@ export function appendMessageDOM(msg: ChatMessage, index: number): void {
|
|||||||
contentHtml += '</div>';
|
contentHtml += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((msg as any)._videoFrames && (msg as any)._videoFrames.length > 0) {
|
if ((msg as any)._videos && (msg as any)._videos.length > 0) {
|
||||||
|
for (const v of (msg as any)._videos) {
|
||||||
|
contentHtml += `<div class="msg-video-indicator">🎬 ${v.fileName} · ${v.frameCount} 帧 · 1fps</div>`;
|
||||||
|
}
|
||||||
|
} else if ((msg as any)._videoFrames && (msg as any)._videoFrames.length > 0) {
|
||||||
const n = (msg as any)._videoFrames.length;
|
const n = (msg as any)._videoFrames.length;
|
||||||
const name = (msg as any)._videoMeta?.fileName || '';
|
contentHtml += `<div class="msg-video-indicator">🎬 ${n} 帧 · 1fps</div>`;
|
||||||
const label = name ? `${name} · ` : '';
|
|
||||||
contentHtml += `<div class="msg-video-indicator">🎬 ${label}${n} 帧 · 1fps</div>`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.files && msg.files.length > 0) {
|
if (msg.files && msg.files.length > 0) {
|
||||||
|
|||||||
@@ -1032,11 +1032,7 @@ async function sendMessageWithAgentLoop(text: string, currentSession: ChatSessio
|
|||||||
if (allVids.length > 0) {
|
if (allVids.length > 0) {
|
||||||
const totalFrames = allVids.flatMap(v => v.frames);
|
const totalFrames = allVids.flatMap(v => v.frames);
|
||||||
msg._videoFrames = totalFrames;
|
msg._videoFrames = totalFrames;
|
||||||
msg._videoMeta = {
|
msg._videos = allVids.map(v => ({ fileName: v.name, frameCount: v.count, duration: v.dur }));
|
||||||
fileName: allVids.length === 1 ? allVids[0].name : `${allVids.length}个视频`,
|
|
||||||
duration: allVids[0].dur,
|
|
||||||
frameCount: totalFrames.length
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
if (userFiles.length > 0) {
|
if (userFiles.length > 0) {
|
||||||
msg.files = userFiles;
|
msg.files = userFiles;
|
||||||
|
|||||||
Vendored
+2
@@ -114,6 +114,8 @@ export interface ChatMessage {
|
|||||||
/** 视频帧数据(用于消息卡片渲染,不走 images 缩略图) */
|
/** 视频帧数据(用于消息卡片渲染,不走 images 缩略图) */
|
||||||
_videoFrames?: Array<{ name: string; base64: string; timestampSeconds: number }>;
|
_videoFrames?: Array<{ name: string; base64: string; timestampSeconds: number }>;
|
||||||
_videoMeta?: { fileName: string; duration: number; frameCount: number };
|
_videoMeta?: { fileName: string; duration: number; frameCount: number };
|
||||||
|
/** 多视频独立指示牌 */
|
||||||
|
_videos?: Array<{ fileName: string; frameCount: number; duration: number }>;
|
||||||
stopped?: boolean;
|
stopped?: boolean;
|
||||||
toolCalls?: ToolCallRecord[];
|
toolCalls?: ToolCallRecord[];
|
||||||
/** 标记此消息为 LLM 压缩摘要生成 */
|
/** 标记此消息为 LLM 压缩摘要生成 */
|
||||||
|
|||||||
Reference in New Issue
Block a user