@xiaohhhh1/canvas-agent 0.4.66 → 0.4.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -171,11 +171,22 @@ export function localVideoAnalysisPrompt(source, durationMs, transcript, attachm
|
|
|
171
171
|
}
|
|
172
172
|
export function assertJointVisualAndSpokenEvidence(analysis) {
|
|
173
173
|
const segments = Array.isArray(analysis.segments) ? analysis.segments : [];
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
174
|
+
const evidencedSegments = segments.filter((segment) => String(segment.visual || "").trim());
|
|
175
|
+
if (evidencedSegments.length < 2)
|
|
176
|
+
throw new Error("本机 Codex 返回的有效画面时间轴不足 2 段,未计为已理解");
|
|
177
|
+
if (evidencedSegments.length === segments.length)
|
|
178
|
+
return;
|
|
179
|
+
// Never invent a visual description for a speech-only/null segment. Keep the
|
|
180
|
+
// independently evidenced beats and record the omission so the server can
|
|
181
|
+
// build an auditable template without throwing away the whole Omni result.
|
|
182
|
+
analysis.segments = evidencedSegments;
|
|
183
|
+
const warnings = Array.isArray(analysis.analysisWarnings)
|
|
184
|
+
? analysis.analysisWarnings.filter((item) => typeof item === "string")
|
|
185
|
+
: [];
|
|
186
|
+
analysis.analysisWarnings = [
|
|
187
|
+
...warnings,
|
|
188
|
+
`已忽略 ${segments.length - evidencedSegments.length} 个缺少独立画面描述的时间段;未臆造画面事实`,
|
|
189
|
+
];
|
|
179
190
|
}
|
|
180
191
|
export function timedTranscriptFromVtt(value) {
|
|
181
192
|
const rows = String(value || "").replace(/^\uFEFF/, "").split(/\r?\n/);
|