@cloud411716/fancy-webnovel 4.11.1 → 4.11.3

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.
@@ -144,6 +144,8 @@ FANCY_DOUYIN_SUBAGENTS=0 # 关闭子 Agent,回退单 Agent 串行
144
144
 
145
145
  子 Agent 不操作 Chrome,不修改 `crawled.json`,不运行 `import.js`,也不直接写素材数据库;数据库导入和采集状态只由父进程串行处理,避免并发覆盖。
146
146
 
147
+ 子 Agent 是独立的新会话,不继承父 Agent 当前对话。因此 `.tmp` 临时文件规则和“不要删除测试文件/不要执行 rm”的约束会直接写进子 Agent 任务提示,而不是依赖父对话。
148
+
147
149
  ## 素材格式
148
150
 
149
151
  每篇作品的 LLM 输出写到:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "4.11.1",
3
+ "version": "4.11.3",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -692,6 +692,10 @@ function subagentTaskPrompt(job, root, materialTools) {
692
692
  '你是 fancy-douyin 的分析子 Agent,只处理下面这一篇作品。',
693
693
  '不要扫描账号,不要启动或操作 Chrome,不要修改 crawled.json,不要运行 import.js 或直接写素材数据库。',
694
694
  '只读取给定文件,按提示词提取素材,写入目标 JSONL,运行 validate.js 后结束。',
695
+ '如果需要创建测试文件,放在当前项目的 `.tmp` 目录下(绝对路径:`' + path.join(root, '.tmp') + '`),并且测试后不需要删除测试文件。',
696
+ '禁止执行 rm、rmdir、find -delete、git clean 等删除命令,也不要删除已有文件。',
697
+ '',
698
+ '以下是本作品的完整分析提示词,必须逐条遵守(包括提取规则、字段要求、清单逐条规则、同风格扩写和校验命令):',
695
699
  '',
696
700
  analysisPromptForJob(job, root, materialTools),
697
701
  ].join('\n');
@@ -963,9 +967,15 @@ async function runCrawl(ctx, invocation, session, taskList) {
963
967
  let skippedMaterials = 0;
964
968
  let aborted = false;
965
969
 
966
- const progressText = () => queue
967
- ? `分析素材(子 Agent 并行:${queueStats.finished}/${queueStats.queued},并发 ${subagentWorkers})`
968
- : `分析素材(${queueStats.finished}/${jobs.length})`;
970
+ const progressText = () => {
971
+ if (taskList.index <= 3) {
972
+ return `采集作品(已入队 ${queueStats.queued},已分析 ${queueStats.finished})`;
973
+ }
974
+ if (queue) {
975
+ return `分析素材(子 Agent 并行:${queueStats.finished}/${queueStats.queued},并发 ${subagentWorkers})`;
976
+ }
977
+ return `分析素材(${queueStats.finished}/${jobs.length})`;
978
+ };
969
979
 
970
980
  const jobRecord = (job, extra = {}) => ({
971
981
  account_url: job.accountUrl,
@@ -1062,14 +1072,13 @@ async function runCrawl(ctx, invocation, session, taskList) {
1062
1072
  reason: '',
1063
1073
  });
1064
1074
  }
1075
+ queueStats.queued += 1;
1065
1076
  if (queue) {
1066
- queueStats.queued += 1;
1067
- if (taskList.index < 4) taskList.advance(4);
1068
1077
  queue.push(job);
1069
- taskList.progress(progressText());
1070
1078
  } else {
1071
1079
  jobs.push(job);
1072
1080
  }
1081
+ taskList.progress(progressText());
1073
1082
  };
1074
1083
 
1075
1084
  const runWorker = async () => {
@@ -1427,8 +1436,11 @@ async function runCrawl(ctx, invocation, session, taskList) {
1427
1436
 
1428
1437
  processedWorks += 1;
1429
1438
  video.account_url = account.url;
1430
- if (taskList.index < 4) taskList.advance(4);
1431
- taskList.progress(`分析素材(视频前 5 秒筛选:${video.title || videoId})`);
1439
+ if (taskList.index <= 3) {
1440
+ taskList.progress(`采集作品(视频前 5 秒筛选:${video.title || videoId})`);
1441
+ } else {
1442
+ taskList.progress(`分析素材(视频前 5 秒筛选:${video.title || videoId})`);
1443
+ }
1432
1444
  const relevance = await analyzeVideoRelevance(ctx, invocation, session, {
1433
1445
  root,
1434
1446
  accountUrl: account.url,
@@ -1596,6 +1608,10 @@ async function runCrawl(ctx, invocation, session, taskList) {
1596
1608
  }
1597
1609
 
1598
1610
  if (queue) {
1611
+ if (taskList.index < 4) {
1612
+ taskList.advance(4);
1613
+ taskList.progress(progressText());
1614
+ }
1599
1615
  queue.close();
1600
1616
  await Promise.all(workerPromises);
1601
1617
  } else if (jobs.length) {
@@ -1701,7 +1717,7 @@ function douyinTaskTitles(invocation) {
1701
1717
  '检查账号与素材库',
1702
1718
  'LLM 能力自检(图片 / 视频)',
1703
1719
  '扫描账号主页',
1704
- '采集图文 / 视频 / 文章作品',
1720
+ '采集作品',
1705
1721
  '分析素材',
1706
1722
  '写入素材库',
1707
1723
  ];