@cloud411716/fancy-webnovel 4.30.34 → 4.30.36
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/docs/material-library/manual/00-core.md +12 -79
- package/docs/material-library/manual/01-carrier.md +8 -38
- package/docs/material-library/manual/04-naming.md +11 -44
- package/docs/material-library/manual/07-surprise.md +10 -84
- package/docs/material-library/prompt.md +58 -144
- package/docs/material-library/quality-spec.md +2 -2
- package/package.json +1 -1
- package/plugins/fancy-material/builtin-styles.js +9 -9
- package/plugins/fancy-material/genre-playbooks.js +3 -3
- package/plugins/fancy-material/index.js +22 -22
- package/plugins/fancy-material/kinds.js +1 -1
- package/plugins/fancy-material/manual.js +2 -20
- package/plugins/fancy-material/prompts/world-mother.md +5 -5
- package/plugins/fancy-material/styles.js +16 -28
- package/plugins/fancy-material/team.js +2 -2
- package/plugins/fancy-material/templates.js +14 -14
- package/plugins/fancy-material/world.js +24 -26
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* 世界设定与 facet 选择状态。
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* 这一层只负责“用户选了什么、世界设定是什么、怎么把交集约束写进提示词”,
|
|
5
5
|
* 不负责素材生成、不碰 material 表。
|
|
6
6
|
*
|
|
7
7
|
* 关键语义:
|
|
@@ -247,7 +247,7 @@ export function scopeQuestion({ currentKinds = [] } = {}) {
|
|
|
247
247
|
}
|
|
248
248
|
options.push({
|
|
249
249
|
label: '推荐:命名 + 世界 + 能力 + 等级 + 剧情',
|
|
250
|
-
description:
|
|
250
|
+
description: `世界设定最相关的 ${recommendedScopeKinds().length} 个 kind`,
|
|
251
251
|
});
|
|
252
252
|
options.push({
|
|
253
253
|
label: `全部 ${MATERIAL_KINDS.length} 个 kind`,
|
|
@@ -322,7 +322,7 @@ export function worldCandidateQuestion(candidates, { allowReroll = true } = {})
|
|
|
322
322
|
if (candidate.difference) bits.push('差异:' + candidate.difference);
|
|
323
323
|
options.push({
|
|
324
324
|
label,
|
|
325
|
-
description: bits.join(';').slice(0, 300) || '
|
|
325
|
+
description: bits.join(';').slice(0, 300) || '世界设定候选',
|
|
326
326
|
});
|
|
327
327
|
}
|
|
328
328
|
if (allowReroll) {
|
|
@@ -331,8 +331,8 @@ export function worldCandidateQuestion(candidates, { allowReroll = true } = {})
|
|
|
331
331
|
options.push({ label: '取消', description: '不生成素材' });
|
|
332
332
|
return {
|
|
333
333
|
id: 'material-world',
|
|
334
|
-
header: '素材 ·
|
|
335
|
-
question: '
|
|
334
|
+
header: '素材 · 世界设定',
|
|
335
|
+
question: '请选择一个世界设定;后续素材都从这个世界设定里长出来',
|
|
336
336
|
detail: '推荐第一个:它优先兑现 _novel_topic_suggestion.json 的方向和定位。选定后可用 /fancy-material continue 沿用同一世界追加素材。',
|
|
337
337
|
options,
|
|
338
338
|
};
|
|
@@ -357,7 +357,7 @@ function normalizeStringArray(value) {
|
|
|
357
357
|
|
|
358
358
|
function normalizeWorldCandidate(raw, index, { constraintGenres = [] } = {}) {
|
|
359
359
|
const source = raw && typeof raw === 'object' ? raw : {};
|
|
360
|
-
const title = clean(source.title || source.name) ||
|
|
360
|
+
const title = clean(source.title || source.name) || `世界设定 ${index + 1}`;
|
|
361
361
|
const coreGenres = normalizeStringArray(source.core_genres || source.genres);
|
|
362
362
|
return {
|
|
363
363
|
world_id: clean(source.world_id || source.id) || `world_${slugFromTitle(title)}`,
|
|
@@ -385,7 +385,7 @@ function normalizeWorldCandidate(raw, index, { constraintGenres = [] } = {}) {
|
|
|
385
385
|
}
|
|
386
386
|
|
|
387
387
|
/**
|
|
388
|
-
* 解析 LLM
|
|
388
|
+
* 解析 LLM 写出的世界设定 JSON。允许纯 JSON、```json 围栏和前后解释。
|
|
389
389
|
*/
|
|
390
390
|
export function parseWorldCandidates(text, { constraintGenres = [] } = {}) {
|
|
391
391
|
const source = stripJsonFence(text);
|
|
@@ -395,11 +395,11 @@ export function parseWorldCandidates(text, { constraintGenres = [] } = {}) {
|
|
|
395
395
|
} catch {
|
|
396
396
|
const start = source.indexOf('{');
|
|
397
397
|
const end = source.lastIndexOf('}');
|
|
398
|
-
if (start < 0 || end <= start) throw new Error('
|
|
398
|
+
if (start < 0 || end <= start) throw new Error('世界设定结果不是 JSON 对象');
|
|
399
399
|
data = JSON.parse(source.slice(start, end + 1));
|
|
400
400
|
}
|
|
401
401
|
const list = Array.isArray(data) ? data : data.candidates;
|
|
402
|
-
if (!Array.isArray(list) || !list.length) throw new Error('
|
|
402
|
+
if (!Array.isArray(list) || !list.length) throw new Error('世界设定结果缺少 candidates 数组');
|
|
403
403
|
return list.slice(0, 3).map((item, index) => normalizeWorldCandidate(item, index, { constraintGenres }));
|
|
404
404
|
}
|
|
405
405
|
|
|
@@ -440,10 +440,10 @@ export function suggestionFingerprint(suggestion) {
|
|
|
440
440
|
}
|
|
441
441
|
|
|
442
442
|
export function flowSummaryText(flow) {
|
|
443
|
-
if (!flow || !flow.world) return '
|
|
443
|
+
if (!flow || !flow.world) return '(没有可沿用的世界设定)';
|
|
444
444
|
const facets = flow.facet_labels || flow.facets || {};
|
|
445
445
|
const lines = [
|
|
446
|
-
'
|
|
446
|
+
'世界设定:' + (flow.world.title || '未命名'),
|
|
447
447
|
flow.world.core_conflict ? '核心矛盾:' + flow.world.core_conflict : '',
|
|
448
448
|
'题材:' + ((facets.genres || []).join('、') || '无(不限)'),
|
|
449
449
|
'场景:' + ((facets.settings || []).join('、') || '无(不限)'),
|
|
@@ -478,7 +478,7 @@ function renderSuggestionBlock(suggestion) {
|
|
|
478
478
|
return [
|
|
479
479
|
'## 选题建议锚点',
|
|
480
480
|
'',
|
|
481
|
-
'当前没有 _novel_topic_suggestion.json。按用户 facet
|
|
481
|
+
'当前没有 _novel_topic_suggestion.json。按用户 facet 自由构建世界设定,但不要伪造选题建议。',
|
|
482
482
|
].join('\n');
|
|
483
483
|
}
|
|
484
484
|
return [
|
|
@@ -489,18 +489,17 @@ function renderSuggestionBlock(suggestion) {
|
|
|
489
489
|
'- 定位:' + (suggestion.positioning || '(无)'),
|
|
490
490
|
'',
|
|
491
491
|
'使用规则:',
|
|
492
|
-
'-
|
|
492
|
+
'- 方向是候选世界设定的锚点,不是最终世界名。',
|
|
493
493
|
'- 定位是读者承诺和核心矛盾,不是命名词表。',
|
|
494
494
|
'- 必须先把定位翻译成 3–5 条世界公理/代价/禁忌,再让名字从公理里长出来。',
|
|
495
|
-
'-
|
|
495
|
+
'- 名字不能停在现实职业词/流程词的裸词状态;日常物件/场所必须加一层世界公理/代价/禁忌的异常边界。',
|
|
496
496
|
'- 禁止把定位里的职业、机构、流程名词裸写成 power_rank / faction_rank / skill_name / faction_name。',
|
|
497
|
-
'- 反例(L1 裸词):试岗、替班、带班、值守、包月令、静音条。',
|
|
498
497
|
].join('\n');
|
|
499
498
|
}
|
|
500
499
|
|
|
501
500
|
function renderStyleBlock(styleSummary = '') {
|
|
502
501
|
if (!styleSummary) {
|
|
503
|
-
return '## 风格锚点\n\n
|
|
502
|
+
return '## 风格锚点\n\n本次未选择账号风格;按通用创作标准,但世界设定仍要成立。';
|
|
504
503
|
}
|
|
505
504
|
return '## 风格锚点\n\n' + styleSummary;
|
|
506
505
|
}
|
|
@@ -519,7 +518,7 @@ export function buildWorldPrompt({
|
|
|
519
518
|
try {
|
|
520
519
|
template = fs.readFileSync(WORLD_PROMPT_FILE, 'utf8');
|
|
521
520
|
} catch (err) {
|
|
522
|
-
throw new Error('
|
|
521
|
+
throw new Error('缺少世界设定提示词文件:' + WORLD_PROMPT_FILE + '(' + (err && err.message ? err.message : String(err)) + ')');
|
|
523
522
|
}
|
|
524
523
|
const previous = previousTitles.length
|
|
525
524
|
? '## 上一批候选(不要重复)\n\n' + previousTitles.map((title) => '- ' + title).join('\n')
|
|
@@ -542,11 +541,11 @@ export function renderWorldBlock({
|
|
|
542
541
|
constraintGenres = [],
|
|
543
542
|
topicGenre = '',
|
|
544
543
|
}) {
|
|
545
|
-
if (!world) return '##
|
|
544
|
+
if (!world) return '## 世界设定\n\n本次没有世界设定,按通用规则生成。';
|
|
546
545
|
const lines = [
|
|
547
|
-
'##
|
|
546
|
+
'## 世界设定(最高优先级)',
|
|
548
547
|
'',
|
|
549
|
-
'-
|
|
548
|
+
'- 世界设定:' + (world.title || '未命名'),
|
|
550
549
|
world.logline ? '- 一句话:' + world.logline : '',
|
|
551
550
|
world.core_conflict ? '- 核心矛盾:' + world.core_conflict : '',
|
|
552
551
|
world.reader_promise ? '- 读者承诺:' + world.reader_promise : '',
|
|
@@ -572,11 +571,10 @@ export function renderWorldBlock({
|
|
|
572
571
|
'- 不同层之间也是交集;不能为了好写而丢掉题材、情绪、场景、情节、身份或关系。',
|
|
573
572
|
'- 素材的 genres 必须原样包含全部核心题材;缺任何一个都算废稿。',
|
|
574
573
|
'- 对应 facet 数组(tropes / moods / settings / roles / relations)必须包含本次选中的全部值;不能只写其中一个。',
|
|
575
|
-
'-
|
|
576
|
-
'-
|
|
577
|
-
'-
|
|
574
|
+
'- 名字必须从世界设定的公理、代价、禁忌里长出来;不能停在现实职业词/流程词的裸词状态。',
|
|
575
|
+
'- 日常物件/场所可以来自现实,但必须加一层世界设定的异常边界、代价或残留;裸写“取号/窗口/回执/试岗/替班”不算名字。',
|
|
576
|
+
'- 世界设定的命名逻辑优先于账号风格的词汇;风格只改变写法,不改变命名逻辑。',
|
|
578
577
|
'- 禁止把 positioning 里的职业/机构/流程名词裸写成 power_rank / faction_rank / skill_name / faction_name。',
|
|
579
|
-
'- 反例(L1 裸词):试岗、替班、带班、值守、包月令、静音条。',
|
|
580
578
|
].filter(Boolean);
|
|
581
579
|
if (world.ability_categories?.length) {
|
|
582
580
|
lines.push('', '### 能力类别', ...world.ability_categories.map((item) => '- ' + (item.name || item)));
|
|
@@ -611,7 +609,7 @@ export function renderWorldBatchSummary({
|
|
|
611
609
|
.filter(Boolean)
|
|
612
610
|
.join(';');
|
|
613
611
|
return [
|
|
614
|
-
'-
|
|
612
|
+
'- 世界设定:' + (world.title || '未命名'),
|
|
615
613
|
world.core_conflict ? '- 核心矛盾:' + world.core_conflict : '',
|
|
616
614
|
world.cost ? '- 核心代价:' + world.cost : '',
|
|
617
615
|
world.naming_logic ? '- 命名逻辑:' + world.naming_logic : '',
|