open-agents-ai 0.170.0 → 0.171.0
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.
- package/dist/index.js +38 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21414,13 +21414,13 @@ var init_video_understand = __esm({
|
|
|
21414
21414
|
try {
|
|
21415
21415
|
const memDir = join41(this.workingDir, ".oa", "memory");
|
|
21416
21416
|
mkdirSync9(memDir, { recursive: true });
|
|
21417
|
-
const
|
|
21418
|
-
let
|
|
21417
|
+
const indexFile = join41(memDir, "video-analyses.json");
|
|
21418
|
+
let indexEntries = [];
|
|
21419
21419
|
try {
|
|
21420
|
-
|
|
21420
|
+
indexEntries = JSON.parse(readFileSync20(indexFile, "utf-8"));
|
|
21421
21421
|
} catch {
|
|
21422
21422
|
}
|
|
21423
|
-
|
|
21423
|
+
indexEntries.push({
|
|
21424
21424
|
source: url || localPath,
|
|
21425
21425
|
title,
|
|
21426
21426
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -21431,9 +21431,40 @@ var init_video_understand = __esm({
|
|
|
21431
21431
|
resultPath: resultFile,
|
|
21432
21432
|
summary: segments.slice(0, 3).map((s) => s.text).join(" ").slice(0, 200)
|
|
21433
21433
|
});
|
|
21434
|
-
if (
|
|
21435
|
-
|
|
21436
|
-
writeFileSync9(
|
|
21434
|
+
if (indexEntries.length > 30)
|
|
21435
|
+
indexEntries = indexEntries.slice(-30);
|
|
21436
|
+
writeFileSync9(indexFile, JSON.stringify(indexEntries, null, 2), "utf-8");
|
|
21437
|
+
const CHUNK_WINDOW = 30;
|
|
21438
|
+
const transcriptFile = join41(memDir, "video-transcripts.json");
|
|
21439
|
+
let transcriptEntries = {};
|
|
21440
|
+
try {
|
|
21441
|
+
transcriptEntries = JSON.parse(readFileSync20(transcriptFile, "utf-8"));
|
|
21442
|
+
} catch {
|
|
21443
|
+
}
|
|
21444
|
+
const videoLabel = title || basename10(url || localPath || "unknown");
|
|
21445
|
+
const chunks = /* @__PURE__ */ new Map();
|
|
21446
|
+
for (const seg of segments) {
|
|
21447
|
+
const chunkIdx = Math.floor(seg.start / CHUNK_WINDOW);
|
|
21448
|
+
if (!chunks.has(chunkIdx))
|
|
21449
|
+
chunks.set(chunkIdx, []);
|
|
21450
|
+
chunks.get(chunkIdx).push(`[${formatTime2(seg.start)}] ${seg.text}`);
|
|
21451
|
+
}
|
|
21452
|
+
for (const [chunkIdx, lines2] of chunks) {
|
|
21453
|
+
const startSec = chunkIdx * CHUNK_WINDOW;
|
|
21454
|
+
const endSec = startSec + CHUNK_WINDOW;
|
|
21455
|
+
const key = `${videoLabel} [${formatTime2(startSec)}-${formatTime2(endSec)}]`;
|
|
21456
|
+
transcriptEntries[key] = {
|
|
21457
|
+
value: `Video: ${videoLabel} | Time: ${formatTime2(startSec)} to ${formatTime2(endSec)}
|
|
21458
|
+
` + lines2.join("\n"),
|
|
21459
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
21460
|
+
};
|
|
21461
|
+
}
|
|
21462
|
+
transcriptEntries[`${videoLabel} \u2014 summary`] = {
|
|
21463
|
+
value: `Video: ${videoLabel} | Duration: ${formatTime2(duration)} | ${segments.length} segments | ${uniqueFrames.length} frames
|
|
21464
|
+
Topic: ${segments.slice(0, 5).map((s) => s.text).join(" ").slice(0, 300)}`,
|
|
21465
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
21466
|
+
};
|
|
21467
|
+
writeFileSync9(transcriptFile, JSON.stringify(transcriptEntries, null, 2), "utf-8");
|
|
21437
21468
|
} catch {
|
|
21438
21469
|
}
|
|
21439
21470
|
const lines = [];
|
package/package.json
CHANGED