@lingjingai/scriptctl 0.63.9 → 0.63.10

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.
@@ -0,0 +1,4 @@
1
+ # 0.63.10
2
+
3
+ - 原片没有音轨时记录证据不足,保留台词与时间并继续画面审核,不再尝试无效音频提取。
4
+ - 审核视频及结构化请求使用服务端默认输出额度。
package/dist/bin.js CHANGED
File without changes
@@ -2474,12 +2474,7 @@ async function generateReviewJson(request) {
2474
2474
  { text: request.prompt }
2475
2475
  ] }],
2476
2476
  ...request.system ? { systemInstruction: { parts: [{ text: request.system }] } } : {},
2477
- generationConfig: {
2478
- temperature: 0,
2479
- responseMimeType: "application/json",
2480
- responseJsonSchema: schema,
2481
- ...request.maxOutputTokens ? { maxOutputTokens: request.maxOutputTokens } : {}
2482
- }
2477
+ generationConfig: { temperature: 0, responseMimeType: "application/json", responseJsonSchema: schema }
2483
2478
  } : {
2484
2479
  model: route.model,
2485
2480
  input: [{ role: "user", content: [
@@ -2487,7 +2482,6 @@ async function generateReviewJson(request) {
2487
2482
  { type: "input_text", text: request.prompt }
2488
2483
  ] }],
2489
2484
  ...request.system ? { instructions: request.system } : {},
2490
- ...request.maxOutputTokens ? { max_output_tokens: request.maxOutputTokens } : {},
2491
2485
  text: { format: { type: "json_schema", name: "review", schema } }
2492
2486
  };
2493
2487
  for (let attempt = 1; attempt <= route.maxAttempts; attempt++) {
@@ -2579,7 +2573,6 @@ async function watchWindow(video, from, to, question, opts) {
2579
2573
  video: { data: fs3.readFileSync(clip2.path, "base64"), fps: CLIP_FPS },
2580
2574
  schema: z3.object({ answer: z3.string().min(1) }),
2581
2575
  timeoutMs: 18e4,
2582
- maxOutputTokens: 2048,
2583
2576
  callKey: opts.callKey
2584
2577
  });
2585
2578
  return { answer: result.value.answer, usage: result.usage.map((row) => ({
@@ -2613,6 +2606,20 @@ var wordsSchema = z4.array(z4.object({
2613
2606
  })).transform((words) => words.filter((word) => word.text.trim().length > 0)).pipe(z4.array(timedTextSchema));
2614
2607
  var utteranceSchema = timedTextSchema.safeExtend({ words: wordsSchema.optional() });
2615
2608
  var responseSchema = z4.object({ result: z4.object({ utterances: z4.array(utteranceSchema) }) });
2609
+ async function hasAudioTrack(video) {
2610
+ const { stdout } = await exec("ffprobe", [
2611
+ "-v",
2612
+ "error",
2613
+ "-select_streams",
2614
+ "a:0",
2615
+ "-show_entries",
2616
+ "stream=index",
2617
+ "-of",
2618
+ "csv=p=0",
2619
+ video
2620
+ ], { timeout: 3e4 });
2621
+ return stdout.trim().length > 0;
2622
+ }
2616
2623
  function parseAsr(raw) {
2617
2624
  return responseSchema.parse(raw).result.utterances;
2618
2625
  }
@@ -3389,6 +3396,18 @@ function resolveComparison(doc, episode, cues, comparison) {
3389
3396
  }
3390
3397
  async function alignEpisode(doc, episode, video, scriptPath, config, onAsrComplete) {
3391
3398
  const root = path4.join(path4.dirname(scriptPath), ".review", "asr", `episode-${episode}`);
3399
+ await fs6.mkdir(root, { recursive: true });
3400
+ if (!await hasAudioTrack(video)) {
3401
+ const report2 = {
3402
+ summary: "\u539F\u7247\u6CA1\u6709\u97F3\u8F68\uFF0C\u65E0\u6CD5\u6267\u884C ASR \u6821\u65F6\uFF1B\u7EE7\u7EED\u5BA1\u6838\u753B\u9762\u4E0E\u5267\u672C\u3002",
3403
+ timestamp_corrections: [],
3404
+ missing_dialogue: [],
3405
+ notes: ["ffprobe \u786E\u8BA4\u539F\u7247\u6CA1\u6709\u97F3\u9891\u6D41\u3002\u4FDD\u7559\u73B0\u6709\u53F0\u8BCD\u53CA\u65F6\u95F4\uFF0C\u4E0D\u6839\u636E\u65E0\u97F3\u8F68\u63A8\u65AD\u53F0\u8BCD\u4E0D\u5B58\u5728\uFF1B\u770B\u7247\u6838\u5BF9\u753B\u9762\u4E0E\u5B57\u5E55\uFF0C\u65E0\u6CD5\u4ECE\u753B\u9762\u786E\u8BA4\u7684\u53D1\u58F0\u5185\u5BB9\u660E\u786E\u6807\u4E3A\u8BC1\u636E\u4E0D\u8DB3\u3002"]
3406
+ };
3407
+ const reportDir2 = await fs6.mkdtemp(path4.join(root, "no-audio-"));
3408
+ await fs6.writeFile(path4.join(reportDir2, "report.json"), JSON.stringify(report2, null, 2));
3409
+ return { report: report2, reportDir: reportDir2, usage: [] };
3410
+ }
3392
3411
  const utterances = await episodeAsr(video, root);
3393
3412
  onAsrComplete?.();
3394
3413
  const script = read(doc, String(episode), { timestamps: true });