@cloud411716/fancy-webnovel 4.30.44 → 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.44",
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: '逐条选择要写入的素材' },
@@ -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);
@@ -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 });
@@ -463,39 +483,21 @@ export async function runNameStage({
463
483
  if (anchorSet.has(row.name)) continue;
464
484
  selectedNew.push(row.name);
465
485
  }
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
486
 
490
487
  const selectedNames = [...anchors, ...selectedNew].filter((name, index, list) => list.indexOf(name) === index);
491
- if (selectedNames.length < keep) {
488
+ if (!selectedNames.length) {
489
+ const error = '没有名字达到 clarity/natural/cold-read 标准;本批不写入,等待下一批或增大名字池。';
492
490
  writeJson(metaFile, {
493
491
  batchId, batchNo, startedAt, finishedAt: new Date().toISOString(), calls,
494
492
  poolSize: merged.length, anchors: anchors.length, keep, screeningTop: targetTop, judges: judgeCount,
495
- selected: selectedNames, warnings,
496
- error: '选中的名字不足:' + selectedNames.length + ' < ' + keep,
493
+ selected: [], warnings, error,
497
494
  });
498
- 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 + ' 条留给下一批,不用次优补位。');
499
501
  }
500
502
 
501
503
  const byName = new Map(merged.map((row) => [row.name, row]));
@@ -541,6 +543,7 @@ export async function runNameStage({
541
543
  anchors: anchors.length,
542
544
  rejected: rejectedList.length,
543
545
  keep,
546
+ shortfall,
544
547
  screeningTop: targetTop,
545
548
  judges: judgeCount,
546
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]);