@cloud411716/fancy-webnovel 4.30.44 → 4.30.46

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.44",
3
+ "version": "4.30.46",
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: '逐条选择要写入的素材' },
@@ -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,
@@ -2286,8 +2286,9 @@ function teamText(root, config) {
2286
2286
  `最多 agent 调用:${config.maxTotalCalls}`,
2287
2287
  `5 轮未通过交裁判:${config.judgeOnMaxRounds ? '是' : '否'}`,
2288
2288
  `入库前人工确认:${config.reviewBeforeImport ? '开启' : '关闭'}`,
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('、') || '(无)'}`,
2289
+ `ability_name 名字阶段:${config.nameStage?.enabled ? '开启' : '关闭'}(池 ${config.nameStage?.poolSize || 80} / 留 ${config.nameStage?.keep || 20} / 裁判 ${config.nameStage?.judges || 3} / 核心 ${config.nameStage?.minScore || 4.5} / 支撑 ${config.nameStage?.supportScore || 4.3})`,
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> | name-support <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);
@@ -2446,6 +2452,13 @@ async function handleTeamCommand(ctx, session, tokens) {
2446
2452
  writeTeamConfig(root, config);
2447
2453
  return notify(session, 'success', `✅ ${key} 已设为 ${n}。`);
2448
2454
  }
2455
+ if (key === 'name-support') {
2456
+ const n = Number(value[0]);
2457
+ if (!Number.isFinite(n) || n < 1 || n > 5) return notify(session, 'error', 'name-support 必须是 1–5。');
2458
+ config.nameStage.supportScore = n;
2459
+ writeTeamConfig(root, config);
2460
+ return notify(session, 'success', `✅ name-support 已设为 ${n}。`);
2461
+ }
2449
2462
  return notify(session, 'error', `未知 team 设置:${key}`);
2450
2463
  }
2451
2464
  return notify(session, 'error', '用法:/fancy-material team show|models [provider]|on|off|reset|set ...');
@@ -159,6 +159,22 @@ function buildNamePrompt({
159
159
  lines.push('名字单看就要有“这怎么可能/代价是什么”的张力;不读 note 也能在一眼里猜出能力方向。');
160
160
  lines.push('读一遍要顺。不要为了凑四字把词压成不自然的缩写:`旧工牌` 不要压成 `旧牌`,`点眼` 不要写成 `点主`。');
161
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('');
162
178
  if (anchors.length) {
163
179
  lines.push('# 用户认可的名字(只学结构,不要直接复用)');
164
180
  lines.push(anchors.join('、'));
@@ -258,6 +274,10 @@ export async function runNameStage({
258
274
  : (Array.isArray(config.anchorNames) ? config.anchorNames : []);
259
275
  const anchorList = rawAnchors.map(normalizeName).filter(Boolean);
260
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;
261
281
  const rejectedList = Array.isArray(config.rejectedNames) ? config.rejectedNames.map(normalizeName).filter(Boolean) : [];
262
282
  const anchorSet = new Set(anchors);
263
283
  const rejectedSet = new Set(rejectedList);
@@ -291,7 +311,7 @@ export async function runNameStage({
291
311
  kind,
292
312
  subkind,
293
313
  count: perSide,
294
- anchors,
314
+ anchors: promptAnchors,
295
315
  rejected: rejectedList,
296
316
  });
297
317
  const promptB = buildNamePrompt({
@@ -303,7 +323,7 @@ export async function runNameStage({
303
323
  kind,
304
324
  subkind,
305
325
  count: perSide,
306
- anchors,
326
+ anchors: promptAnchors,
307
327
  rejected: rejectedList,
308
328
  });
309
329
  fs.mkdirSync(runDir, { recursive: true });
@@ -430,6 +450,7 @@ export async function runNameStage({
430
450
 
431
451
  const screeningRank = new Map(screeningOrder.map((name, index) => [name, index]));
432
452
  const minScore = Math.max(1, Math.min(5, Number(config.minScore) || 4.5));
453
+ const supportScore = Math.max(1, Math.min(5, Number(config.supportScore) || 4.3));
433
454
  const ranked = panelNames
434
455
  .map((name) => {
435
456
  const scores = scoreMap.get(name) || { hook: [], distinct: [], image: [], clarity: [], natural: [], coldRead: [] };
@@ -439,6 +460,8 @@ export async function runNameStage({
439
460
  const clarity = average(scores.clarity);
440
461
  const natural = average(scores.natural);
441
462
  const coldRead = average(scores.coldRead);
463
+ const coreMin = Math.min(clarity, natural, coldRead);
464
+ const supportMin = Math.min(hook, distinct);
442
465
  return {
443
466
  name,
444
467
  hook,
@@ -447,55 +470,43 @@ export async function runNameStage({
447
470
  clarity,
448
471
  natural,
449
472
  coldRead,
473
+ coreMin,
474
+ supportMin,
475
+ qualified: coreMin >= minScore && supportMin >= supportScore,
450
476
  min: Math.min(hook, distinct, clarity, natural, coldRead),
451
477
  total: hook + distinct + image + clarity + natural + coldRead,
452
478
  rank: screeningRank.get(name) ?? 999,
453
479
  interpretation: interpretations.get(name) || '',
454
480
  };
455
481
  })
456
- .sort((a, b) => (b.min - a.min) || (b.total - a.total) || (a.rank - b.rank));
482
+ .sort((a, b) => (Number(b.qualified) - Number(a.qualified))
483
+ || (b.coreMin - a.coreMin)
484
+ || (b.total - a.total)
485
+ || (a.rank - b.rank));
457
486
 
458
487
  const needed = Math.max(0, keep - anchors.length);
459
488
  const selectedNew = [];
460
- const strictlyQualified = ranked.filter((row) => row.min >= minScore);
489
+ const strictlyQualified = ranked.filter((row) => row.qualified);
461
490
  for (const row of strictlyQualified) {
462
491
  if (selectedNew.length >= needed) break;
463
492
  if (anchorSet.has(row.name)) continue;
464
493
  selectedNew.push(row.name);
465
494
  }
466
- if (selectedNew.length < needed) {
467
- warnings.push('clarity/natural/cold-read 全达标的候选不足,使用次优补位:'
468
- + selectedNew.length + '/' + needed);
469
- for (const row of ranked) {
470
- if (selectedNew.length >= needed) break;
471
- if (anchorSet.has(row.name) || selectedNew.includes(row.name)) continue;
472
- selectedNew.push(row.name);
473
- }
474
- }
475
- if (selectedNew.length < needed) {
476
- for (const name of screeningOrder) {
477
- if (selectedNew.length >= needed) break;
478
- if (anchorSet.has(name) || selectedNew.includes(name)) continue;
479
- selectedNew.push(name);
480
- }
481
- }
482
- if (selectedNew.length < needed) {
483
- for (const row of merged) {
484
- if (selectedNew.length >= needed) break;
485
- if (anchorSet.has(row.name) || selectedNew.includes(row.name)) continue;
486
- selectedNew.push(row.name);
487
- }
488
- }
489
495
 
490
496
  const selectedNames = [...anchors, ...selectedNew].filter((name, index, list) => list.indexOf(name) === index);
491
- if (selectedNames.length < keep) {
497
+ if (!selectedNames.length) {
498
+ const error = '没有名字达到 clarity/natural/cold-read 标准;本批不写入,等待下一批或增大名字池。';
492
499
  writeJson(metaFile, {
493
500
  batchId, batchNo, startedAt, finishedAt: new Date().toISOString(), calls,
494
501
  poolSize: merged.length, anchors: anchors.length, keep, screeningTop: targetTop, judges: judgeCount,
495
- selected: selectedNames, warnings,
496
- error: '选中的名字不足:' + selectedNames.length + ' < ' + keep,
502
+ selected: [], warnings, error,
497
503
  });
498
- return { ok: false, error: 'name-stage 选中的名字不足:' + selectedNames.length + ' < ' + keep };
504
+ return { ok: false, error };
505
+ }
506
+ const shortfall = Math.max(0, keep - selectedNames.length);
507
+ if (shortfall > 0) {
508
+ warnings.push('严格达标不足:本批只写 ' + selectedNames.length + '/' + keep
509
+ + ' 条,剩余 ' + shortfall + ' 条留给下一批,不用次优补位。');
499
510
  }
500
511
 
501
512
  const byName = new Map(merged.map((row) => [row.name, row]));
@@ -523,13 +534,11 @@ export async function runNameStage({
523
534
  const finishedAt = new Date().toISOString();
524
535
  const belowThreshold = selected
525
536
  .filter((row) => row.score)
526
- .filter((row) => Math.min(
527
- row.score.hook,
528
- row.score.distinct,
529
- row.score.clarity,
530
- row.score.natural,
531
- row.score.coldRead,
532
- ) < minScore)
537
+ .filter((row) => {
538
+ const coreMin = Math.min(row.score.clarity, row.score.natural, row.score.coldRead);
539
+ const supportMin = Math.min(row.score.hook, row.score.distinct);
540
+ return coreMin < minScore || supportMin < supportScore;
541
+ })
533
542
  .map((row) => row.name);
534
543
  const meta = {
535
544
  batchId,
@@ -541,9 +550,11 @@ export async function runNameStage({
541
550
  anchors: anchors.length,
542
551
  rejected: rejectedList.length,
543
552
  keep,
553
+ shortfall,
544
554
  screeningTop: targetTop,
545
555
  judges: judgeCount,
546
556
  minScore,
557
+ supportScore,
547
558
  belowThreshold,
548
559
  calls,
549
560
  selected: selected.map((row) => row.name),
@@ -30,7 +30,9 @@ const DEFAULT_TEAM = Object.freeze({
30
30
  screeningTop: 30,
31
31
  judges: 3,
32
32
  minScore: 4.5,
33
+ supportScore: 4.3,
33
34
  anchorNames: [],
35
+ styleAnchors: [],
34
36
  rejectedNames: [],
35
37
  },
36
38
  });
@@ -67,7 +69,9 @@ export function readTeamConfig(root) {
67
69
  screeningTop: clampInt(ns.screeningTop, 10, 200, 30),
68
70
  judges: clampInt(ns.judges, 1, 5, 3),
69
71
  minScore: Math.max(1, Math.min(5, Number(ns.minScore) || 4.5)),
72
+ supportScore: Math.max(1, Math.min(5, Number(ns.supportScore) || 4.3)),
70
73
  anchorNames: stringArray(ns.anchorNames, []),
74
+ styleAnchors: stringArray(ns.styleAnchors, []),
71
75
  rejectedNames: stringArray(ns.rejectedNames, []),
72
76
  };
73
77
  for (const key of ['generatorA', 'generatorB', 'judge']) out[key] = normalizeRoute(out[key]);