@cloud411716/fancy-webnovel 4.30.43 → 4.30.45

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloud411716/fancy-webnovel",
3
- "version": "4.30.43",
3
+ "version": "4.30.45",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -960,7 +960,7 @@ async function confirmMaterialImport(ctx, invocation, session, records, previewF
960
960
  const first = await askOne(ctx, invocation, {
961
961
  id: 'material_import_confirm',
962
962
  header: '素材入库',
963
- question: `以上 ${records.length} 条素材要写入数据库吗?`,
963
+ question: `${preview}\n\n---\n以上 ${records.length} 条素材要写入数据库吗?`,
964
964
  options: [
965
965
  { label: '全部写入', description: '把全部素材写入数据库' },
966
966
  { label: '选择部分', description: '逐条选择要写入的素材' },
@@ -1867,7 +1867,7 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
1867
1867
  batchId,
1868
1868
  batchNo,
1869
1869
  keep: Math.min(next.requestCount, Math.max(0, item.target - item.generated)),
1870
- poolSize: Math.max(30, Math.min(Number(nameStage.poolSize) || 80, Math.max(30, Math.min(next.requestCount, Math.max(0, item.target - item.generated)) * 6))),
1870
+ poolSize: Math.max(30, Math.min(Number(nameStage.poolSize) || 80, Math.max(30, Math.min(next.requestCount, Math.max(0, item.target - item.generated)) * 8))),
1871
1871
  anchorNames: item.generated === 0 ? (Array.isArray(nameStage.anchorNames) ? nameStage.anchorNames : []) : [],
1872
1872
  });
1873
1873
  if (!nameOut.ok) {
@@ -1969,7 +1969,7 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
1969
1969
  kindTotal: pending.length,
1970
1970
  generated: item.generated,
1971
1971
  dbExisting: item.db_existing,
1972
- requestCount: next.requestCount,
1972
+ requestCount: lockedNames.length ? Math.min(next.requestCount, lockedNames.length) : next.requestCount,
1973
1973
  includeBase,
1974
1974
  validateScript: tools.validateScript,
1975
1975
  queryScript: tools.queryScript,
@@ -2287,7 +2287,8 @@ function teamText(root, config) {
2287
2287
  `5 轮未通过交裁判:${config.judgeOnMaxRounds ? '是' : '否'}`,
2288
2288
  `入库前人工确认:${config.reviewBeforeImport ? '开启' : '关闭'}`,
2289
2289
  `ability_name 名字阶段:${config.nameStage?.enabled ? '开启' : '关闭'}(池 ${config.nameStage?.poolSize || 80} / 留 ${config.nameStage?.keep || 20} / 裁判 ${config.nameStage?.judges || 3} / 达标 ${config.nameStage?.minScore || 4.5})`,
2290
- `锚点名字:${(config.nameStage?.anchorNames || []).join('、') || '(无)'}`,
2290
+ `强制锚点:${(config.nameStage?.anchorNames || []).join('、') || '(无)'}`,
2291
+ `风格锚点:${(config.nameStage?.styleAnchors || []).join('、') || '(无)'}`,
2291
2292
  '',
2292
2293
  `配置文件:${teamConfigPath(root)}`,
2293
2294
  '',
@@ -2345,7 +2346,7 @@ async function handleTeamCommand(ctx, session, tokens) {
2345
2346
  const key = String(tokens[1] || '').toLowerCase();
2346
2347
  const value = tokens.slice(2);
2347
2348
  if (!key) {
2348
- return notify(session, 'error', '用法:/fancy-material team set a|b|judge <provider> <model> [thinking] | rounds <n> | max-calls <n> | mode <cross|oneway> | judge-on-max <true|false> | review-before-import on|off | name-stage on|off | anchors <名字...> | rejected <名字...> | name-pool <n> | name-keep <n> | name-judges <n>');
2349
+ return notify(session, 'error', '用法:/fancy-material team set a|b|judge <provider> <model> [thinking] | rounds <n> | max-calls <n> | mode <cross|oneway> | judge-on-max <true|false> | review-before-import on|off | name-stage on|off | anchors <名字...> | style-anchors <名字...> | rejected <名字...> | name-pool <n> | name-keep <n> | name-judges <n>');
2349
2350
  }
2350
2351
  if (key === 'a' || key === 'b' || key === 'judge') {
2351
2352
  if (value.length < 2) {
@@ -2425,6 +2426,11 @@ async function handleTeamCommand(ctx, session, tokens) {
2425
2426
  writeTeamConfig(root, config);
2426
2427
  return notify(session, 'success', `✅ 已设置 ${config.nameStage.anchorNames.length} 个锚点名字。`);
2427
2428
  }
2429
+ if (key === 'style-anchors') {
2430
+ config.nameStage.styleAnchors = value.join(' ').split(/[,,\s]+/).map((item) => item.trim()).filter(Boolean);
2431
+ writeTeamConfig(root, config);
2432
+ return notify(session, 'success', `✅ 已设置 ${config.nameStage.styleAnchors.length} 个风格锚点。`);
2433
+ }
2428
2434
  if (key === 'rejected') {
2429
2435
  config.nameStage.rejectedNames = value.join(' ').split(/[,,\s]+/).map((item) => item.trim()).filter(Boolean);
2430
2436
  writeTeamConfig(root, config);
@@ -153,10 +153,28 @@ function buildNamePrompt({
153
153
  lines.push('2. **主体 + 动作**:`工牌借脸`、`檐灰点眼`');
154
154
  lines.push('3. **条件 + 后果**:`灯灭名断`');
155
155
  lines.push('');
156
+ lines.push('4 字名优先 **2+2**:前两字是物象,后两字是结果/状态或强动作。');
156
157
  lines.push('避免:**物象 + 动词 + 隐含对象**的三截压缩,例如 `灯烬点名`、`旧牌借脸`——读者要先补主语/宾语才知道发生了什么。');
158
+ lines.push('先在心里写一句普通句子,再压成 4 字;压完如果还要补主语或宾语,换一个名字。');
157
159
  lines.push('名字单看就要有“这怎么可能/代价是什么”的张力;不读 note 也能在一眼里猜出能力方向。');
158
160
  lines.push('读一遍要顺。不要为了凑四字把词压成不自然的缩写:`旧工牌` 不要压成 `旧牌`,`点眼` 不要写成 `点主`。');
159
161
  lines.push('');
162
+ lines.push('# 语义角色测试');
163
+ lines.push('每个名字必须能填满这句话:**谁/什么 + 对谁/什么 + 做了什么/发生了什么**。填不满就重写。');
164
+ lines.push('不要用“工具类别 + 缺宾语的动词”:');
165
+ lines.push('- 坏:`香篆锁喉`(谁被锁?念字触发还是香灰触发?)');
166
+ lines.push('- 坏:`香帚扫名`(扫谁的名?名去哪了?)');
167
+ lines.push('- 坏:`供桌收影`(收谁的影?)');
168
+ lines.push('- 坏:`匾额换姓`(匾换姓还是人换姓?)');
169
+ lines.push('- 坏:`锁眼借脸`(谁借谁的脸?)');
170
+ lines.push('改成“物象细节 + 明确对象/结果”:');
171
+ lines.push('- `篆灰声断`、`断帚名散`、`桌下影替`、`凿匾姓消`、`锁孔换脸`');
172
+ lines.push('前半不要写工具类别(香篆、香帚、供桌、匾额、锁眼、粉笔);要写被选中的细节(篆灰、断帚、桌下影、匾上凿痕、锁孔锈、粉笔灰)。');
173
+ lines.push('后半不要写缺宾语的动词(锁喉、扫名、收影、换姓、借脸、断罪);要写明确对象或结果(声断、名散、影替、姓消、脸换、罪落)。');
174
+ lines.push('');
175
+ lines.push('# 物象分布');
176
+ lines.push('至少一半名字来自公共设施/身体/城市日常(灯、路、水、电、门、梯、车、桥、骨、血、脸、影、声),不要整批都是神殿器物(香篆、香帚、供桌、匾额、神像)。');
177
+ lines.push('');
160
178
  if (anchors.length) {
161
179
  lines.push('# 用户认可的名字(只学结构,不要直接复用)');
162
180
  lines.push(anchors.join('、'));
@@ -256,6 +274,10 @@ export async function runNameStage({
256
274
  : (Array.isArray(config.anchorNames) ? config.anchorNames : []);
257
275
  const anchorList = rawAnchors.map(normalizeName).filter(Boolean);
258
276
  const anchors = [...new Set(anchorList)].slice(0, keep);
277
+ const styleAnchorList = Array.isArray(config.styleAnchors)
278
+ ? config.styleAnchors.map(normalizeName).filter(Boolean)
279
+ : [];
280
+ const promptAnchors = styleAnchorList.length ? [...new Set(styleAnchorList)] : anchors;
259
281
  const rejectedList = Array.isArray(config.rejectedNames) ? config.rejectedNames.map(normalizeName).filter(Boolean) : [];
260
282
  const anchorSet = new Set(anchors);
261
283
  const rejectedSet = new Set(rejectedList);
@@ -276,28 +298,32 @@ export async function runNameStage({
276
298
  return { ok: false, error: 'name-stage 需要 generatorA / generatorB / judge 三条模型路由。' };
277
299
  }
278
300
 
301
+ const nameWorldBlock = String(worldBlock || '')
302
+ .split(/\r?\n/)
303
+ .filter((line) => !line.includes('命名逻辑'))
304
+ .join('\n');
279
305
  const promptA = buildNamePrompt({
280
306
  role: 'A',
281
307
  targetFile: aFile,
282
- worldBlock,
308
+ worldBlock: nameWorldBlock,
283
309
  styleSummary,
284
310
  genres,
285
311
  kind,
286
312
  subkind,
287
313
  count: perSide,
288
- anchors,
314
+ anchors: promptAnchors,
289
315
  rejected: rejectedList,
290
316
  });
291
317
  const promptB = buildNamePrompt({
292
318
  role: 'B',
293
319
  targetFile: bFile,
294
- worldBlock,
320
+ worldBlock: nameWorldBlock,
295
321
  styleSummary,
296
322
  genres,
297
323
  kind,
298
324
  subkind,
299
325
  count: perSide,
300
- anchors,
326
+ anchors: promptAnchors,
301
327
  rejected: rejectedList,
302
328
  });
303
329
  fs.mkdirSync(runDir, { recursive: true });
@@ -457,39 +483,21 @@ export async function runNameStage({
457
483
  if (anchorSet.has(row.name)) continue;
458
484
  selectedNew.push(row.name);
459
485
  }
460
- if (selectedNew.length < needed) {
461
- warnings.push('clarity/natural/cold-read 全达标的候选不足,使用次优补位:'
462
- + selectedNew.length + '/' + needed);
463
- for (const row of ranked) {
464
- if (selectedNew.length >= needed) break;
465
- if (anchorSet.has(row.name) || selectedNew.includes(row.name)) continue;
466
- selectedNew.push(row.name);
467
- }
468
- }
469
- if (selectedNew.length < needed) {
470
- for (const name of screeningOrder) {
471
- if (selectedNew.length >= needed) break;
472
- if (anchorSet.has(name) || selectedNew.includes(name)) continue;
473
- selectedNew.push(name);
474
- }
475
- }
476
- if (selectedNew.length < needed) {
477
- for (const row of merged) {
478
- if (selectedNew.length >= needed) break;
479
- if (anchorSet.has(row.name) || selectedNew.includes(row.name)) continue;
480
- selectedNew.push(row.name);
481
- }
482
- }
483
486
 
484
487
  const selectedNames = [...anchors, ...selectedNew].filter((name, index, list) => list.indexOf(name) === index);
485
- if (selectedNames.length < keep) {
488
+ if (!selectedNames.length) {
489
+ const error = '没有名字达到 clarity/natural/cold-read 标准;本批不写入,等待下一批或增大名字池。';
486
490
  writeJson(metaFile, {
487
491
  batchId, batchNo, startedAt, finishedAt: new Date().toISOString(), calls,
488
492
  poolSize: merged.length, anchors: anchors.length, keep, screeningTop: targetTop, judges: judgeCount,
489
- selected: selectedNames, warnings,
490
- error: '选中的名字不足:' + selectedNames.length + ' < ' + keep,
493
+ selected: [], warnings, error,
491
494
  });
492
- return { ok: false, error: 'name-stage 选中的名字不足:' + selectedNames.length + ' < ' + keep };
495
+ return { ok: false, error };
496
+ }
497
+ const shortfall = Math.max(0, keep - selectedNames.length);
498
+ if (shortfall > 0) {
499
+ warnings.push('严格达标不足:本批只写 ' + selectedNames.length + '/' + keep
500
+ + ' 条,剩余 ' + shortfall + ' 条留给下一批,不用次优补位。');
493
501
  }
494
502
 
495
503
  const byName = new Map(merged.map((row) => [row.name, row]));
@@ -535,6 +543,7 @@ export async function runNameStage({
535
543
  anchors: anchors.length,
536
544
  rejected: rejectedList.length,
537
545
  keep,
546
+ shortfall,
538
547
  screeningTop: targetTop,
539
548
  judges: judgeCount,
540
549
  minScore,
@@ -31,6 +31,7 @@ const DEFAULT_TEAM = Object.freeze({
31
31
  judges: 3,
32
32
  minScore: 4.5,
33
33
  anchorNames: [],
34
+ styleAnchors: [],
34
35
  rejectedNames: [],
35
36
  },
36
37
  });
@@ -68,6 +69,7 @@ export function readTeamConfig(root) {
68
69
  judges: clampInt(ns.judges, 1, 5, 3),
69
70
  minScore: Math.max(1, Math.min(5, Number(ns.minScore) || 4.5)),
70
71
  anchorNames: stringArray(ns.anchorNames, []),
72
+ styleAnchors: stringArray(ns.styleAnchors, []),
71
73
  rejectedNames: stringArray(ns.rejectedNames, []),
72
74
  };
73
75
  for (const key of ['generatorA', 'generatorB', 'judge']) out[key] = normalizeRoute(out[key]);