@cloud411716/fancy-webnovel 4.30.46 → 4.30.48

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.46",
3
+ "version": "4.30.48",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -938,7 +938,15 @@ function answerSingle(answer) {
938
938
  return Array.isArray(answer.selected) ? String(answer.selected[0] || '').trim() : '';
939
939
  }
940
940
 
941
- function materialPreviewText(records) {
941
+ function clipPreviewText(value, limit = 90) {
942
+ return String(value || '')
943
+ .replace(/\|/g, '\\|')
944
+ .replace(/\s+/g, ' ')
945
+ .trim()
946
+ .slice(0, limit);
947
+ }
948
+
949
+ function materialFullPreviewText(records) {
942
950
  const lines = [
943
951
  `## 待确认入库(${records.length} 条)`,
944
952
  '',
@@ -954,13 +962,30 @@ function materialPreviewText(records) {
954
962
  return lines.join('\n');
955
963
  }
956
964
 
965
+ function materialPreviewText(records, previewFile = '') {
966
+ const lines = [
967
+ `## 待确认入库(${records.length} 条)`,
968
+ '',
969
+ '以下素材已经通过 Team 交叉审查和裁判,但**还没有写入数据库**。',
970
+ '',
971
+ '| # | 名字 | note 摘要 | derivation 摘要 |',
972
+ '|---:|---|---|---|',
973
+ ];
974
+ records.forEach((record, index) => {
975
+ lines.push(`| ${index + 1} | ${record.name || '未命名'} | ${clipPreviewText(record.note)} | ${clipPreviewText(record.derivation)} |`);
976
+ });
977
+ lines.push('');
978
+ if (previewFile) lines.push(`完整预览:${previewFile}`);
979
+ return lines.join('\n');
980
+ }
981
+
957
982
  async function confirmMaterialImport(ctx, invocation, session, records, previewFile = '') {
958
- const preview = materialPreviewText(records) + (previewFile ? `\n\n预览文件:${previewFile}` : '');
983
+ const preview = materialPreviewText(records, previewFile);
959
984
  await notify(session, 'success', preview);
960
985
  const first = await askOne(ctx, invocation, {
961
986
  id: 'material_import_confirm',
962
987
  header: '素材入库',
963
- question: `${preview}\n\n---\n以上 ${records.length} 条素材要写入数据库吗?`,
988
+ question: `以上 ${records.length} 条素材要写入数据库吗?`,
964
989
  options: [
965
990
  { label: '全部写入', description: '把全部素材写入数据库' },
966
991
  { label: '选择部分', description: '逐条选择要写入的素材' },
@@ -2085,7 +2110,7 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
2085
2110
  const recordsForReview = readJsonlRecords(file);
2086
2111
  if (recordsForReview.length) {
2087
2112
  const previewFile = file.replace(/\.jsonl$/, '.review.md');
2088
- fs.writeFileSync(previewFile, materialPreviewText(recordsForReview) + '\n', 'utf8');
2113
+ fs.writeFileSync(previewFile, materialFullPreviewText(recordsForReview) + '\n', 'utf8');
2089
2114
  reviewResult = await confirmMaterialImport(ctx, invocation, session, recordsForReview, previewFile);
2090
2115
  if (!reviewResult.ok) {
2091
2116
  fatal = true;
@@ -32,9 +32,10 @@ const NAME_SCORE_SCHEMA = {
32
32
  clarity: { type: 'number' },
33
33
  natural: { type: 'number' },
34
34
  coldRead: { type: 'number' },
35
+ bare: { type: 'boolean' },
35
36
  interpretation: { type: 'string' },
36
37
  },
37
- required: ['name', 'hook', 'distinct', 'image', 'clarity', 'natural', 'coldRead'],
38
+ required: ['name', 'hook', 'distinct', 'image', 'clarity', 'natural', 'coldRead', 'bare'],
38
39
  },
39
40
  },
40
41
  },
@@ -140,6 +141,35 @@ function buildNamePrompt({
140
141
  lines.push('');
141
142
  lines.push('不要按题材/子域分类,不要列内容清单,不要按公式逐条填。直接从“物象”出发。');
142
143
  lines.push('');
144
+ lines.push('# 材料密度(11 来源,只借“可提取物”)');
145
+ lines.push('名字阶段不写来源名、不写映射;只借下面这些来源提供的物象/机制/约束。来源映射留给 note/derivation。');
146
+ lines.push('高密度优先:3、5、6、7、8、9、11;1、2、4、10 作为补充,不要为了凑来源硬用。');
147
+ lines.push('- 1 诗词:情绪母题、物候、留白、盛衰、谶谣(低优先,除非古风)');
148
+ lines.push('- 2 典籍博物:山川、异兽习性、古器物、工艺、奇物约束');
149
+ lines.push('- 3 神话/民俗/术数:神格权责、仪式、禁忌、因果账本、偿还逻辑');
150
+ lines.push('- 4 外国神话:原型、契约、异化、禁忌知识、认知扭曲');
151
+ lines.push('- 5 历史/制度/律法/经济:制度漏洞、债务、身份、层层成本、博弈');
152
+ lines.push('- 6 科学/技术/医学/认知:硬约束、代偿、反馈、损耗、信号失真');
153
+ lines.push('- 7 艺术/感官/器物/工艺/媒介:材质、工艺、媒介局限、留白');
154
+ lines.push('- 8 日常/职业/城市/网络:只取流程死角、隐性规矩、设施上的异常痕迹;不要把设施名直接当物象');
155
+ lines.push('- 9 心理/哲学/梦境:认知陷阱、身份分裂、执念、记忆虚构');
156
+ lines.push('- 10 叙事母题/戏剧/游戏:闭环、替身、归还、循环、观测者');
157
+ lines.push('- 11 成套符号/序列:对立权柄、等级、同源、序列枷锁');
158
+ lines.push('');
159
+ lines.push('# 结构镜头(10 组公式,可选,不强制)');
160
+ lines.push('公式只是起点,不是免责牌;名字仍然要通过下面的物象/语义角色测试。');
161
+ lines.push('同批至少用 4 种镜头,同一种最多 3 条;不要每条都套公式。');
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('');
143
173
  lines.push('# 物象标准');
144
174
  lines.push('不是功能对象,而是被选中的细节:带质感、痕迹、仪式、禁忌、记忆或反常的具体形象。');
145
175
  lines.push('- 日历是对象;忌日那页、撕不掉的旧历是物象。');
@@ -147,9 +177,16 @@ function buildNamePrompt({
147
177
  lines.push('- 棺材是对象;空棺是物象。');
148
178
  lines.push('- 面具是对象;傩面是物象。');
149
179
  lines.push('- 下水道是对象;暗渠是物象。');
180
+ lines.push('- 钟摆、门缝、铁皮、鞋印、门槛、灯杆、车窗、水管、砖缝、锁孔:这些是**裸器物/部位/材料**,不是物象。');
181
+ lines.push('- 停摆、焦缝、锈铁、残印、凹槛、歪杆、裂窗、漏水、缺砖、锈孔:这些才是物象。');
182
+ lines.push('');
183
+ lines.push('# 裸名测试');
184
+ lines.push('前两字如果只是器物/部位/材料名,没有状态、痕迹、限定或仪式感,直接判为“对象”,不是“物象”,重写。');
185
+ lines.push('不要用:钟摆、门缝、铁皮、鞋印、门槛、灯杆、车窗、水管、砖缝、柜台、抽屉、锁孔、钥匙。');
186
+ lines.push('要写成带状态/痕迹/限定的物象:停摆、焦缝、锈铁、残印、凹槛、歪杆、裂窗、漏水、缺砖、空屉、锈孔、断钥。');
150
187
  lines.push('');
151
188
  lines.push('名字结构优先:');
152
- lines.push('1. **物象 + 结果/状态**:`灯烬名灭`、`门槛吃岁`');
189
+ lines.push('1. **物象 + 结果/状态**:`灯烬名灭`、`凹槛吃岁`');
153
190
  lines.push('2. **主体 + 动作**:`工牌借脸`、`檐灰点眼`');
154
191
  lines.push('3. **条件 + 后果**:`灯灭名断`');
155
192
  lines.push('');
@@ -173,7 +210,8 @@ function buildNamePrompt({
173
210
  lines.push('后半不要写缺宾语的动词(锁喉、扫名、收影、换姓、借脸、断罪);要写明确对象或结果(声断、名散、影替、姓消、脸换、罪落)。');
174
211
  lines.push('');
175
212
  lines.push('# 物象分布');
176
- lines.push('至少一半名字来自公共设施/身体/城市日常(灯、路、水、电、门、梯、车、桥、骨、血、脸、影、声),不要整批都是神殿器物(香篆、香帚、供桌、匾额、神像)。');
213
+ lines.push('不要整批神殿器物,也不要整批裸日常设施;名字前半必须是带痕迹/状态的物象,不是设施/部位/材料名。');
214
+ lines.push('同批至少覆盖 4 类物象:身体痕迹、仪式残迹、城市设施上的异常、器物缺损、空间边界、文书/身份残留;同一类最多 3 条。');
177
215
  lines.push('');
178
216
  if (anchors.length) {
179
217
  lines.push('# 用户认可的名字(只学结构,不要直接复用)');
@@ -225,16 +263,17 @@ function buildScorePrompt(names) {
225
263
  '对每个名字按 1–5 分评分(允许 0.5):',
226
264
  '- hook:第一眼吸引力。5 = 一眼记住;4.5 = 很强;4 = 好但眼熟;3 = 普通。',
227
265
  '- distinct:独特性。5 = 不常见且不可替换;4.5 = 有明显辨识度;4 = 同类里常见。',
228
- '- image:物象感。5 = 有一个带质感/痕迹/仪式/禁忌的具体物象;4 = 有画面但偏普通;3 = 功能对象或流程词。',
266
+ '- image:物象感。5 = 物象带质感/痕迹/仪式/禁忌;4 = 有画面但偏普通;3 = 功能对象或流程词;**如果前两字只是裸器物/部位/材料名(钟摆、门缝、铁皮、鞋印、门槛、灯杆、车窗、水管、砖缝、锁孔),最高 3.5。**',
229
267
  '- clarity:第一读能不能说出能力方向。5 = 一遍就懂;4.5 = 稍一停顿就懂;4 = 需要补一步;3 = 要读 note 才懂。',
230
268
  '- natural:像不像自然中文。5 = 顺口自然;4.5 = 略压缩但顺;4 = 像代号/标题;3 = 生硬、需要硬脑补。',
231
269
  '- coldRead:只看名字,能不能用一句话说出“这能力干什么”。5 = 能;4.5 = 接近;4 = 只能说个大概;3 = 只能感到气氛。',
270
+ '- bare:前两字是否只是裸器物/部位/材料名,没有状态/痕迹/限定?是 = true,否 = false。',
232
271
  '',
233
272
  '同时给每个名字写一句 `interpretation`:你只看名字时,第一反应它是什么能力。不要补设定。',
234
273
  '',
235
274
  list,
236
275
  '',
237
- '只返回 JSON:{"scores":[{"name":"名字","hook":0,"distinct":0,"image":0,"clarity":0,"natural":0,"coldRead":0,"interpretation":"一句话"}]}。不要解释,不要改写名字。',
276
+ '只返回 JSON:{"scores":[{"name":"名字","hook":0,"distinct":0,"image":0,"clarity":0,"natural":0,"coldRead":0,"bare":false,"interpretation":"一句话"}]}。不要解释,不要改写名字。',
238
277
  ].join('\n');
239
278
  }
240
279
 
@@ -435,13 +474,14 @@ export async function runNameStage({
435
474
  const name = normalizeName(row.name);
436
475
  if (!panelNames.includes(name)) continue;
437
476
  if (!scoreMap.has(name)) {
438
- scoreMap.set(name, { hook: [], distinct: [], image: [], clarity: [], natural: [], coldRead: [] });
477
+ scoreMap.set(name, { hook: [], distinct: [], image: [], clarity: [], natural: [], coldRead: [], bare: [] });
439
478
  }
440
479
  const scores = scoreMap.get(name);
441
480
  for (const key of ['hook', 'distinct', 'image', 'clarity', 'natural', 'coldRead']) {
442
481
  const value = Number(row[key]);
443
482
  if (Number.isFinite(value)) scores[key].push(value);
444
483
  }
484
+ scores.bare.push(row.bare === true);
445
485
  if (typeof row.interpretation === 'string' && row.interpretation.trim() && !interpretations.has(name)) {
446
486
  interpretations.set(name, row.interpretation.trim());
447
487
  }
@@ -453,13 +493,14 @@ export async function runNameStage({
453
493
  const supportScore = Math.max(1, Math.min(5, Number(config.supportScore) || 4.3));
454
494
  const ranked = panelNames
455
495
  .map((name) => {
456
- const scores = scoreMap.get(name) || { hook: [], distinct: [], image: [], clarity: [], natural: [], coldRead: [] };
496
+ const scores = scoreMap.get(name) || { hook: [], distinct: [], image: [], clarity: [], natural: [], coldRead: [], bare: [] };
457
497
  const hook = average(scores.hook);
458
498
  const distinct = average(scores.distinct);
459
499
  const image = average(scores.image);
460
500
  const clarity = average(scores.clarity);
461
501
  const natural = average(scores.natural);
462
502
  const coldRead = average(scores.coldRead);
503
+ const bare = scores.bare.some(Boolean);
463
504
  const coreMin = Math.min(clarity, natural, coldRead);
464
505
  const supportMin = Math.min(hook, distinct);
465
506
  return {
@@ -470,9 +511,10 @@ export async function runNameStage({
470
511
  clarity,
471
512
  natural,
472
513
  coldRead,
514
+ bare,
473
515
  coreMin,
474
516
  supportMin,
475
- qualified: coreMin >= minScore && supportMin >= supportScore,
517
+ qualified: !bare && coreMin >= minScore && supportMin >= supportScore,
476
518
  min: Math.min(hook, distinct, clarity, natural, coldRead),
477
519
  total: hook + distinct + image + clarity + natural + coldRead,
478
520
  rank: screeningRank.get(name) ?? 999,
@@ -525,6 +567,7 @@ export async function runNameStage({
525
567
  clarity: score.clarity,
526
568
  natural: score.natural,
527
569
  coldRead: score.coldRead,
570
+ bare: score.bare,
528
571
  },
529
572
  ...(score.interpretation ? { interpretation: score.interpretation } : {}),
530
573
  } : {}),
@@ -537,7 +580,7 @@ export async function runNameStage({
537
580
  .filter((row) => {
538
581
  const coreMin = Math.min(row.score.clarity, row.score.natural, row.score.coldRead);
539
582
  const supportMin = Math.min(row.score.hook, row.score.distinct);
540
- return coreMin < minScore || supportMin < supportScore;
583
+ return row.score.bare === true || coreMin < minScore || supportMin < supportScore;
541
584
  })
542
585
  .map((row) => row.name);
543
586
  const meta = {