@cloud411716/fancy-webnovel 4.30.41 → 4.30.42

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.41",
3
+ "version": "4.30.42",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -1811,7 +1811,7 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
1811
1811
  batchId,
1812
1812
  batchNo,
1813
1813
  keep: Math.min(next.requestCount, Math.max(0, item.target - item.generated)),
1814
- poolSize: Math.max(30, Math.min(Number(nameStage.poolSize) || 80, Math.max(30, Math.min(next.requestCount, Math.max(0, item.target - item.generated)) * 4))),
1814
+ 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))),
1815
1815
  anchorNames: item.generated === 0 ? (Array.isArray(nameStage.anchorNames) ? nameStage.anchorNames : []) : [],
1816
1816
  });
1817
1817
  if (!nameOut.ok) {
@@ -2190,7 +2190,7 @@ function teamText(root, config) {
2190
2190
  `最多审查轮次:${config.maxReviewRounds}`,
2191
2191
  `最多 agent 调用:${config.maxTotalCalls}`,
2192
2192
  `5 轮未通过交裁判:${config.judgeOnMaxRounds ? '是' : '否'}`,
2193
- `ability_name 名字阶段:${config.nameStage?.enabled ? '开启' : '关闭'}(池 ${config.nameStage?.poolSize || 80} / 留 ${config.nameStage?.keep || 20} / 裁判 ${config.nameStage?.judges || 3})`,
2193
+ `ability_name 名字阶段:${config.nameStage?.enabled ? '开启' : '关闭'}(池 ${config.nameStage?.poolSize || 80} / 留 ${config.nameStage?.keep || 20} / 裁判 ${config.nameStage?.judges || 3} / 达标 ${config.nameStage?.minScore || 4.5})`,
2194
2194
  `锚点名字:${(config.nameStage?.anchorNames || []).join('、') || '(无)'}`,
2195
2195
  '',
2196
2196
  `配置文件:${teamConfigPath(root)}`,
@@ -29,8 +29,12 @@ const NAME_SCORE_SCHEMA = {
29
29
  hook: { type: 'number' },
30
30
  distinct: { type: 'number' },
31
31
  image: { type: 'number' },
32
+ clarity: { type: 'number' },
33
+ natural: { type: 'number' },
34
+ coldRead: { type: 'number' },
35
+ interpretation: { type: 'string' },
32
36
  },
33
- required: ['name', 'hook', 'distinct', 'image'],
37
+ required: ['name', 'hook', 'distinct', 'image', 'clarity', 'natural', 'coldRead'],
34
38
  },
35
39
  },
36
40
  },
@@ -144,8 +148,14 @@ function buildNamePrompt({
144
148
  lines.push('- 面具是对象;傩面是物象。');
145
149
  lines.push('- 下水道是对象;暗渠是物象。');
146
150
  lines.push('');
147
- lines.push('名字结构:**物象 + 强动词 + 神圣/身份对象或巨大后果**。');
148
- lines.push('名字单看就要有“这怎么可能/代价是什么”的张力;不读 note 也能猜出能力方向。');
151
+ lines.push('名字结构优先:');
152
+ lines.push('1. **物象 + 结果/状态**:`灯烬名灭`、`门槛吃岁`');
153
+ lines.push('2. **主体 + 动作**:`工牌借脸`、`檐灰点眼`');
154
+ lines.push('3. **条件 + 后果**:`灯灭名断`');
155
+ lines.push('');
156
+ lines.push('避免:**物象 + 动词 + 隐含对象**的三截压缩,例如 `灯烬点名`、`旧牌借脸`——读者要先补主语/宾语才知道发生了什么。');
157
+ lines.push('名字单看就要有“这怎么可能/代价是什么”的张力;不读 note 也能在一眼里猜出能力方向。');
158
+ lines.push('读一遍要顺。不要为了凑四字把词压成不自然的缩写:`旧工牌` 不要压成 `旧牌`,`点眼` 不要写成 `点主`。');
149
159
  lines.push('');
150
160
  if (anchors.length) {
151
161
  lines.push('# 用户认可的名字(只学结构,不要直接复用)');
@@ -198,10 +208,15 @@ function buildScorePrompt(names) {
198
208
  '- hook:第一眼吸引力。5 = 一眼记住;4.5 = 很强;4 = 好但眼熟;3 = 普通。',
199
209
  '- distinct:独特性。5 = 不常见且不可替换;4.5 = 有明显辨识度;4 = 同类里常见。',
200
210
  '- image:物象感。5 = 有一个带质感/痕迹/仪式/禁忌的具体物象;4 = 有画面但偏普通;3 = 功能对象或流程词。',
211
+ '- clarity:第一读能不能说出能力方向。5 = 一遍就懂;4.5 = 稍一停顿就懂;4 = 需要补一步;3 = 要读 note 才懂。',
212
+ '- natural:像不像自然中文。5 = 顺口自然;4.5 = 略压缩但顺;4 = 像代号/标题;3 = 生硬、需要硬脑补。',
213
+ '- coldRead:只看名字,能不能用一句话说出“这能力干什么”。5 = 能;4.5 = 接近;4 = 只能说个大概;3 = 只能感到气氛。',
214
+ '',
215
+ '同时给每个名字写一句 `interpretation`:你只看名字时,第一反应它是什么能力。不要补设定。',
201
216
  '',
202
217
  list,
203
218
  '',
204
- '只返回 JSON:{"scores":[{"name":"名字","hook":0,"distinct":0,"image":0}]}。不要解释,不要改写名字。',
219
+ '只返回 JSON:{"scores":[{"name":"名字","hook":0,"distinct":0,"image":0,"clarity":0,"natural":0,"coldRead":0,"interpretation":"一句话"}]}。不要解释,不要改写名字。',
205
220
  ].join('\n');
206
221
  }
207
222
 
@@ -369,6 +384,7 @@ export async function runNameStage({
369
384
 
370
385
  const panelNames = screeningOrder.slice(0, targetTop);
371
386
  const scoreMap = new Map();
387
+ const interpretations = new Map();
372
388
  const panelResults = await Promise.all(
373
389
  Array.from({ length: judgeCount }, (_, index) => {
374
390
  const shuffled = shuffle(panelNames, Number(batchNo) * 104729 + index * 97 + 31);
@@ -392,40 +408,64 @@ export async function runNameStage({
392
408
  for (const row of result.value.scores) {
393
409
  const name = normalizeName(row.name);
394
410
  if (!panelNames.includes(name)) continue;
395
- if (!scoreMap.has(name)) scoreMap.set(name, { hook: [], distinct: [], image: [] });
411
+ if (!scoreMap.has(name)) {
412
+ scoreMap.set(name, { hook: [], distinct: [], image: [], clarity: [], natural: [], coldRead: [] });
413
+ }
396
414
  const scores = scoreMap.get(name);
397
- for (const key of ['hook', 'distinct', 'image']) {
415
+ for (const key of ['hook', 'distinct', 'image', 'clarity', 'natural', 'coldRead']) {
398
416
  const value = Number(row[key]);
399
417
  if (Number.isFinite(value)) scores[key].push(value);
400
418
  }
419
+ if (typeof row.interpretation === 'string' && row.interpretation.trim() && !interpretations.has(name)) {
420
+ interpretations.set(name, row.interpretation.trim());
421
+ }
401
422
  }
402
423
  }
403
424
 
404
425
  const screeningRank = new Map(screeningOrder.map((name, index) => [name, index]));
426
+ const minScore = Math.max(1, Math.min(5, Number(config.minScore) || 4.5));
405
427
  const ranked = panelNames
406
428
  .map((name) => {
407
- const scores = scoreMap.get(name) || { hook: [], distinct: [], image: [] };
429
+ const scores = scoreMap.get(name) || { hook: [], distinct: [], image: [], clarity: [], natural: [], coldRead: [] };
408
430
  const hook = average(scores.hook);
409
431
  const distinct = average(scores.distinct);
410
432
  const image = average(scores.image);
433
+ const clarity = average(scores.clarity);
434
+ const natural = average(scores.natural);
435
+ const coldRead = average(scores.coldRead);
411
436
  return {
412
437
  name,
413
438
  hook,
414
439
  distinct,
415
440
  image,
416
- total: hook + distinct + image,
441
+ clarity,
442
+ natural,
443
+ coldRead,
444
+ min: Math.min(hook, distinct, clarity, natural, coldRead),
445
+ total: hook + distinct + image + clarity + natural + coldRead,
417
446
  rank: screeningRank.get(name) ?? 999,
447
+ interpretation: interpretations.get(name) || '',
418
448
  };
419
449
  })
420
- .sort((a, b) => (b.total - a.total) || (a.rank - b.rank));
450
+ .sort((a, b) => (b.min - a.min) || (b.total - a.total) || (a.rank - b.rank));
421
451
 
422
452
  const needed = Math.max(0, keep - anchors.length);
423
453
  const selectedNew = [];
424
- for (const row of ranked) {
454
+ const strictlyQualified = ranked.filter((row) => row.min >= minScore);
455
+ for (const row of strictlyQualified) {
425
456
  if (selectedNew.length >= needed) break;
426
457
  if (anchorSet.has(row.name)) continue;
427
458
  selectedNew.push(row.name);
428
459
  }
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
+ }
429
469
  if (selectedNew.length < needed) {
430
470
  for (const name of screeningOrder) {
431
471
  if (selectedNew.length >= needed) break;
@@ -460,11 +500,31 @@ export async function runNameStage({
460
500
  return {
461
501
  ...row,
462
502
  anchor: anchorSet.has(name),
463
- ...(score ? { score: { hook: score.hook, distinct: score.distinct, image: score.image } } : {}),
503
+ ...(score ? {
504
+ score: {
505
+ hook: score.hook,
506
+ distinct: score.distinct,
507
+ image: score.image,
508
+ clarity: score.clarity,
509
+ natural: score.natural,
510
+ coldRead: score.coldRead,
511
+ },
512
+ ...(score.interpretation ? { interpretation: score.interpretation } : {}),
513
+ } : {}),
464
514
  };
465
515
  });
466
516
  writeJsonl(selectedFile, selected);
467
517
  const finishedAt = new Date().toISOString();
518
+ const belowThreshold = selected
519
+ .filter((row) => row.score)
520
+ .filter((row) => Math.min(
521
+ row.score.hook,
522
+ row.score.distinct,
523
+ row.score.clarity,
524
+ row.score.natural,
525
+ row.score.coldRead,
526
+ ) < minScore)
527
+ .map((row) => row.name);
468
528
  const meta = {
469
529
  batchId,
470
530
  batchNo,
@@ -477,6 +537,8 @@ export async function runNameStage({
477
537
  keep,
478
538
  screeningTop: targetTop,
479
539
  judges: judgeCount,
540
+ minScore,
541
+ belowThreshold,
480
542
  calls,
481
543
  selected: selected.map((row) => row.name),
482
544
  warnings,
@@ -28,6 +28,7 @@ const DEFAULT_TEAM = Object.freeze({
28
28
  keep: 20,
29
29
  screeningTop: 30,
30
30
  judges: 3,
31
+ minScore: 4.5,
31
32
  anchorNames: [],
32
33
  rejectedNames: [],
33
34
  },
@@ -63,6 +64,7 @@ export function readTeamConfig(root) {
63
64
  keep: clampInt(ns.keep, 1, 100, 20),
64
65
  screeningTop: clampInt(ns.screeningTop, 10, 200, 30),
65
66
  judges: clampInt(ns.judges, 1, 5, 3),
67
+ minScore: Math.max(1, Math.min(5, Number(ns.minScore) || 4.5)),
66
68
  anchorNames: stringArray(ns.anchorNames, []),
67
69
  rejectedNames: stringArray(ns.rejectedNames, []),
68
70
  };