@cloud411716/fancy-webnovel 4.29.1 → 4.30.0
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/douyin-plugin.md +1 -1
- package/docs/material-library/README.md +24 -18
- package/docs/material-library/backlog.md +171 -0
- package/docs/material-library/import.js +16 -3
- package/docs/material-library/prompt.md +12 -9
- package/docs/material-library/queries.surql +2 -2
- package/docs/material-library/sample.jsonl +8 -7
- package/docs/material-library/schema.surql +17 -10
- package/docs/workspace-mcp.md +1 -1
- package/lib/material-db.js +4 -4
- package/lib/material-topic.js +3 -0
- package/package.json +1 -1
- package/plugins/fancy-bootstrap/index.js +1 -1
- package/plugins/fancy-db/index.js +1 -1
- package/plugins/fancy-material/exporter.js +5 -1
- package/plugins/fancy-material/index.js +316 -118
- package/plugins/fancy-material/inventory.js +7 -5
- package/plugins/fancy-material/kinds.js +47 -20
- package/plugins/fancy-material/plan.js +190 -0
- package/plugins/fancy-material/prompts/world-mother.md +11 -1
- package/plugins/fancy-material/styles.js +1 -1
- package/plugins/fancy-material/templates.js +170 -7
- package/plugins/fancy-material/validate.js +14 -2
- package/plugins/fancy-material/world.js +29 -11
- package/plugins/fancy-topic/index.js +2 -2
- package/plugins/fancy-topic/prompts/02-setup-prompt.md +3 -2
- package/plugins/fancy-topic/templates.js +2 -1
|
@@ -10,8 +10,8 @@ export const KIND_GROUPS = [
|
|
|
10
10
|
{
|
|
11
11
|
title: '命名',
|
|
12
12
|
kinds: [
|
|
13
|
-
'
|
|
14
|
-
'skill_name', '
|
|
13
|
+
'person_name', 'nickname', 'place_name', 'faction_name',
|
|
14
|
+
'skill_name', 'item_name', 'monster_name', 'mythic_being',
|
|
15
15
|
],
|
|
16
16
|
},
|
|
17
17
|
{
|
|
@@ -28,10 +28,15 @@ export const KIND_GROUPS = [
|
|
|
28
28
|
{
|
|
29
29
|
title: '能力',
|
|
30
30
|
kinds: [
|
|
31
|
+
'ability_name', 'ability_visual', 'ability_slogan',
|
|
31
32
|
'ability_mechanism', 'ability_activation', 'ability_cost', 'ability_limit',
|
|
32
33
|
'ability_counter', 'power_source',
|
|
33
34
|
],
|
|
34
35
|
},
|
|
36
|
+
{
|
|
37
|
+
title: '等级',
|
|
38
|
+
kinds: ['power_rank', 'faction_rank'],
|
|
39
|
+
},
|
|
35
40
|
{
|
|
36
41
|
title: '物品',
|
|
37
42
|
kinds: [
|
|
@@ -62,17 +67,21 @@ export const KIND_GROUPS = [
|
|
|
62
67
|
},
|
|
63
68
|
{
|
|
64
69
|
title: '剧情与脑洞',
|
|
65
|
-
kinds: [
|
|
66
|
-
'brainstorm', 'conflict_seed', 'conflict_escalation', 'plot_twist',
|
|
67
|
-
'mystery_seed', 'payoff_scene', 'trope',
|
|
68
|
-
],
|
|
70
|
+
kinds: ['brainstorm', 'foreshadow'],
|
|
69
71
|
},
|
|
70
72
|
];
|
|
71
73
|
|
|
72
74
|
export const MATERIAL_KINDS = KIND_GROUPS.flatMap((group) => group.kinds);
|
|
73
75
|
|
|
74
76
|
export const KIND_LABELS = {
|
|
77
|
+
person_name: '完整姓名',
|
|
78
|
+
ability_visual: '能力特效',
|
|
79
|
+
ability_slogan: '能力口号/咏唱',
|
|
80
|
+
power_rank: '力量等级/境界',
|
|
81
|
+
faction_rank: '势力职务等级',
|
|
82
|
+
foreshadow: '伏笔/线索',
|
|
75
83
|
surname: '姓氏',
|
|
84
|
+
|
|
76
85
|
given_name: '名',
|
|
77
86
|
nickname: '绰号/代号',
|
|
78
87
|
place_name: '地名',
|
|
@@ -136,10 +145,16 @@ export const KIND_LABELS = {
|
|
|
136
145
|
* 每个 kind 的「亮眼 + 好读」质量要求。
|
|
137
146
|
*
|
|
138
147
|
* 这是提示词里「素材类型总表」的第四列;与 KIND_LABELS/DEFAULT_HINTS 一起
|
|
139
|
-
* 构成
|
|
148
|
+
* 构成 55 个 kind 的单一事实来源。help 只打印 kind + 中文名,提示词才展开
|
|
140
149
|
* 这一列,避免帮助信息过长。
|
|
141
150
|
*/
|
|
142
151
|
export const KIND_QUALITY = {
|
|
152
|
+
person_name: '完整姓名,姓与名组合后要有整体效果和记忆点;禁止拆成“姓+名”两个独立素材;名字要贴合题材、时代、阶层和人物气质,读起来顺口,不用生僻字堆砌。',
|
|
153
|
+
ability_visual: '只写能力发动时可见的特效,必须和本批能力类别一致;有具体形态、颜色、运动方式和感官落点,不写“炫酷/强大/神秘”这类空泛评价。',
|
|
154
|
+
ability_slogan: '一句能代表能力气质的口号/咏唱,短、可读、有画面;同一类别内可替换,不直接解释数值;不写通用鸡汤和空泛霸气。',
|
|
155
|
+
power_rank: '一套力量体系中的一个有序等级;有层级递进感,能看出高低;名字贴合体系文化,不用“一级/初级”这种直白编号。',
|
|
156
|
+
faction_rank: '一个势力类型中的一个有序职务等级;能看出权责和晋升关系,贴合势力文化;不要和力量境界混用。',
|
|
157
|
+
foreshadow: '一个可种植、可回收的伏笔物件/信息/关系;必须有明确的出现场景和回收价值,不能写成“神秘秘密”这种空话,也不能写成通用利益冲突。',
|
|
143
158
|
surname: '有典籍出处或历史渊源;避免极生僻字、多音易误读字;辨识度高于普通大姓,但读者能顺畅认读;严格匹配题材时代与地域背景,禁止跨文化乱入。',
|
|
144
159
|
given_name: '有画面感与意象底色;不用生僻字堆砌文雅感;读音顺口、字形协调,符合对应题材的时代语感;禁止三个字全是生僻字、读音拗口的组合。',
|
|
145
160
|
nickname: '贴合人物能力/身份/标志性动作,有记忆点,不低俗;有对应题材的专属语感(江湖/组织/赛博/教会);顺口好记,喊出来有气场。',
|
|
@@ -201,6 +216,12 @@ export const KIND_QUALITY = {
|
|
|
201
216
|
};
|
|
202
217
|
|
|
203
218
|
const DEFAULT_HINTS = {
|
|
219
|
+
person_name: '一个完整姓名',
|
|
220
|
+
ability_visual: '一句能力特效',
|
|
221
|
+
ability_slogan: '一句能力口号/咏唱',
|
|
222
|
+
power_rank: '一个力量等级/境界名',
|
|
223
|
+
faction_rank: '一个势力职务等级名',
|
|
224
|
+
foreshadow: '一个可种植、可回收的伏笔/线索',
|
|
204
225
|
surname: '一个姓氏',
|
|
205
226
|
given_name: '一个名',
|
|
206
227
|
nickname: '一个绰号或代号',
|
|
@@ -262,20 +283,23 @@ const DEFAULT_HINTS = {
|
|
|
262
283
|
};
|
|
263
284
|
|
|
264
285
|
const EXTRA_ALIASES = {
|
|
265
|
-
命名: ['
|
|
286
|
+
命名: ['person_name', 'nickname', 'place_name', 'faction_name', 'skill_name', 'item_name', 'monster_name', 'mythic_being'],
|
|
266
287
|
人物: ['person_appearance', 'person_temperament', 'person_personality', 'person_habit', 'person_voice', 'person_background'],
|
|
267
288
|
人物性格: ['person_personality'],
|
|
268
289
|
人物外貌: ['person_appearance'],
|
|
269
|
-
能力: ['ability_name', 'ability_mechanism', 'ability_activation', 'ability_cost', 'ability_limit', 'ability_counter', 'power_source'
|
|
270
|
-
|
|
290
|
+
能力: ['ability_name', 'ability_visual', 'ability_slogan', 'ability_mechanism', 'ability_activation', 'ability_cost', 'ability_limit', 'ability_counter', 'power_source'],
|
|
291
|
+
能力特效: ['ability_visual'],
|
|
292
|
+
能力口号: ['ability_slogan'],
|
|
293
|
+
口号: ['ability_slogan'],
|
|
294
|
+
物品: ['item_form', 'item_material', 'item_function', 'item_visual'],
|
|
271
295
|
场景: ['location_feature', 'weather', 'sensory_taste', 'sensory_visual'],
|
|
272
296
|
描写: ['color_word', 'light_word', 'sound_word', 'smell_word', 'touch_word', 'effect_word', 'speed_word', 'atmosphere_word', 'appearance_word', 'expression_word', 'action_verb'],
|
|
273
297
|
世界: ['world_rule', 'faction_culture', 'faction_symbol', 'ritual'],
|
|
274
|
-
剧情: ['brainstorm', '
|
|
275
|
-
姓名: ['
|
|
276
|
-
人名: ['
|
|
277
|
-
名字: ['
|
|
278
|
-
姓氏: ['
|
|
298
|
+
剧情: ['brainstorm', 'foreshadow'],
|
|
299
|
+
姓名: ['person_name'],
|
|
300
|
+
人名: ['person_name', 'nickname'],
|
|
301
|
+
名字: ['person_name'],
|
|
302
|
+
姓氏: ['person_name'],
|
|
279
303
|
地名: ['place_name'],
|
|
280
304
|
地点: ['place_name', 'location_feature'],
|
|
281
305
|
门派: ['faction_name'],
|
|
@@ -300,8 +324,11 @@ const EXTRA_ALIASES = {
|
|
|
300
324
|
神明: ['mythic_being'],
|
|
301
325
|
神灵: ['mythic_being'],
|
|
302
326
|
超自然物种: ['mythic_being'],
|
|
303
|
-
境界: ['
|
|
304
|
-
|
|
327
|
+
境界: ['power_rank'],
|
|
328
|
+
力量等级: ['power_rank'],
|
|
329
|
+
等级: ['power_rank', 'faction_rank'],
|
|
330
|
+
职务: ['faction_rank'],
|
|
331
|
+
职位: ['faction_rank'],
|
|
305
332
|
颜色: ['color_word'],
|
|
306
333
|
颜色词: ['color_word'],
|
|
307
334
|
光影: ['light_word'],
|
|
@@ -321,8 +348,8 @@ const EXTRA_ALIASES = {
|
|
|
321
348
|
世界规则: ['world_rule'],
|
|
322
349
|
规则: ['world_rule'],
|
|
323
350
|
脑洞: ['brainstorm'],
|
|
324
|
-
|
|
325
|
-
|
|
351
|
+
伏笔: ['foreshadow'],
|
|
352
|
+
线索: ['foreshadow'],
|
|
326
353
|
场景: ['location_feature'],
|
|
327
354
|
情绪节拍: ['emotion_beat'],
|
|
328
355
|
关系动态: ['relationship_dynamic'],
|
|
@@ -414,7 +441,7 @@ export function resolveCustomKinds({ materialType, kinds = [] }) {
|
|
|
414
441
|
*
|
|
415
442
|
* 与内置目录最大的区别:
|
|
416
443
|
* - source 必须是 other;
|
|
417
|
-
* - 素材类型可以不在
|
|
444
|
+
* - 素材类型可以不在 55 个 kind 里,模型可以自拟 kind;
|
|
418
445
|
* - 同一批只能用一个 kind,插件会在第一轮之后记住它。
|
|
419
446
|
*/
|
|
420
447
|
export function customFocusBlock({ genre, materialType, kinds = [], allKinds = false }) {
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generation planning for the new material taxonomy.
|
|
3
|
+
*
|
|
4
|
+
* Surface pools are generated by kind (50 entries each by default).
|
|
5
|
+
* Ability / faction pools are generated per category.
|
|
6
|
+
* Ability cores and rank ladders are generated as coherent bundles, not as
|
|
7
|
+
* independent records per component kind.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { KIND_LABELS } from './kinds.js';
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_SURFACE_TARGET = 50;
|
|
13
|
+
export const DEFAULT_WORLD_RULE_TARGET = 6;
|
|
14
|
+
export const DEFAULT_ABILITY_CORE_SETS = 3;
|
|
15
|
+
export const DEFAULT_RANK_LADDER_SETS = 3;
|
|
16
|
+
export const DEFAULT_RANK_LEVELS = 10;
|
|
17
|
+
|
|
18
|
+
export const ABILITY_POOL_KINDS = ['ability_name', 'ability_visual', 'ability_slogan'];
|
|
19
|
+
export const ABILITY_CORE_KINDS = [
|
|
20
|
+
'ability_mechanism', 'ability_activation', 'ability_cost',
|
|
21
|
+
'ability_limit', 'ability_counter', 'power_source',
|
|
22
|
+
];
|
|
23
|
+
export const FACTION_POOL_KINDS = ['faction_name', 'faction_culture', 'faction_symbol', 'ritual'];
|
|
24
|
+
export const RANK_KINDS = ['power_rank', 'faction_rank'];
|
|
25
|
+
|
|
26
|
+
function clean(value) {
|
|
27
|
+
return String(value == null ? '' : value).trim();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function unique(values) {
|
|
31
|
+
const seen = new Set();
|
|
32
|
+
const out = [];
|
|
33
|
+
for (const value of values) {
|
|
34
|
+
const text = clean(value);
|
|
35
|
+
if (!text || seen.has(text)) continue;
|
|
36
|
+
seen.add(text);
|
|
37
|
+
out.push(text);
|
|
38
|
+
}
|
|
39
|
+
return out;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* World 里可能写成字符串数组,也可能写成 [{name,description}]。
|
|
44
|
+
* 统一成 [{name,description}],并保留顺序。
|
|
45
|
+
*/
|
|
46
|
+
export function normalizeCategories(value, fallback = []) {
|
|
47
|
+
const list = Array.isArray(value) ? value : [];
|
|
48
|
+
const out = [];
|
|
49
|
+
const seen = new Set();
|
|
50
|
+
for (const item of list) {
|
|
51
|
+
const name = typeof item === 'string' ? item : clean(item && item.name);
|
|
52
|
+
if (!name || seen.has(name)) continue;
|
|
53
|
+
seen.add(name);
|
|
54
|
+
out.push({
|
|
55
|
+
name,
|
|
56
|
+
description: typeof item === 'object' && item ? clean(item.description) : '',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
if (out.length) return out;
|
|
60
|
+
return unique(fallback).map((name) => ({ name, description: '' }));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function buildGenerationItems({ kinds = [], world = null, targetPerKind = DEFAULT_SURFACE_TARGET } = {}) {
|
|
64
|
+
const selected = unique(kinds);
|
|
65
|
+
const surfaceTarget = Math.max(1, Number(targetPerKind) || DEFAULT_SURFACE_TARGET);
|
|
66
|
+
const abilityCategories = normalizeCategories(world?.ability_categories, ['通用能力']);
|
|
67
|
+
const factionTypes = normalizeCategories(world?.faction_types, ['通用势力']);
|
|
68
|
+
const powerSystems = normalizeCategories(world?.power_systems, ['通用力量体系']);
|
|
69
|
+
const items = [];
|
|
70
|
+
const handled = new Set();
|
|
71
|
+
|
|
72
|
+
const addKind = (kind, extra = {}) => {
|
|
73
|
+
if (!kind || handled.has(kind + '\u0000' + (extra.subkind || ''))) return;
|
|
74
|
+
handled.add(kind + '\u0000' + (extra.subkind || ''));
|
|
75
|
+
items.push({
|
|
76
|
+
mode: 'kind',
|
|
77
|
+
key: [kind, extra.subkind || ''].filter(Boolean).join(':'),
|
|
78
|
+
kind,
|
|
79
|
+
subkind: extra.subkind || '',
|
|
80
|
+
group_id: extra.group_id || '',
|
|
81
|
+
target: extra.target || surfaceTarget,
|
|
82
|
+
label: extra.label || (extra.subkind ? `${extra.subkind} · ${KIND_LABELS[kind] || kind}` : (KIND_LABELS[kind] || kind)),
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// 能力名 / 特效 / 口号:每个能力类别各 50。
|
|
87
|
+
for (let ci = 0; ci < abilityCategories.length; ci += 1) {
|
|
88
|
+
const category = abilityCategories[ci];
|
|
89
|
+
for (const kind of selected.filter((item) => ABILITY_POOL_KINDS.includes(item))) {
|
|
90
|
+
addKind(kind, {
|
|
91
|
+
subkind: category.name,
|
|
92
|
+
group_id: `group_ability_${String(ci + 1).padStart(2, '0')}_${kind}_v4`,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 能力核心:每个能力类别 2-3 套,每套 6 个部件。
|
|
98
|
+
if (selected.some((kind) => ABILITY_CORE_KINDS.includes(kind))) {
|
|
99
|
+
for (let ci = 0; ci < abilityCategories.length; ci += 1) {
|
|
100
|
+
const category = abilityCategories[ci];
|
|
101
|
+
items.push({
|
|
102
|
+
mode: 'ability_core',
|
|
103
|
+
key: `ability_core:${category.name}`,
|
|
104
|
+
kind: '',
|
|
105
|
+
kinds: [...ABILITY_CORE_KINDS],
|
|
106
|
+
subkind: category.name,
|
|
107
|
+
target: DEFAULT_ABILITY_CORE_SETS,
|
|
108
|
+
groupPrefix: `group_ability_${String(ci + 1).padStart(2, '0')}_core`,
|
|
109
|
+
label: `${category.name} · 能力核心组`,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// 势力名 / 文化 / 信物 / 仪式:每个势力类型各 50。
|
|
115
|
+
for (let fi = 0; fi < factionTypes.length; fi += 1) {
|
|
116
|
+
const type = factionTypes[fi];
|
|
117
|
+
for (const kind of selected.filter((item) => FACTION_POOL_KINDS.includes(item))) {
|
|
118
|
+
addKind(kind, {
|
|
119
|
+
subkind: type.name,
|
|
120
|
+
group_id: `group_faction_${String(fi + 1).padStart(2, '0')}_${kind}_v4`,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// 力量等级:每个力量体系 3-5 套阶梯。
|
|
126
|
+
if (selected.includes('power_rank')) {
|
|
127
|
+
for (let si = 0; si < powerSystems.length; si += 1) {
|
|
128
|
+
const system = powerSystems[si];
|
|
129
|
+
items.push({
|
|
130
|
+
mode: 'rank_ladder',
|
|
131
|
+
key: `power_rank:${system.name}`,
|
|
132
|
+
kind: 'power_rank',
|
|
133
|
+
subkind: system.name,
|
|
134
|
+
target: DEFAULT_RANK_LADDER_SETS,
|
|
135
|
+
levels: DEFAULT_RANK_LEVELS,
|
|
136
|
+
groupPrefix: `group_power_${String(si + 1).padStart(2, '0')}_rank`,
|
|
137
|
+
label: `${system.name} · 力量等级阶梯`,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// 势力职务:每个势力类型 3-5 套阶梯。
|
|
143
|
+
if (selected.includes('faction_rank')) {
|
|
144
|
+
for (let fi = 0; fi < factionTypes.length; fi += 1) {
|
|
145
|
+
const type = factionTypes[fi];
|
|
146
|
+
items.push({
|
|
147
|
+
mode: 'rank_ladder',
|
|
148
|
+
key: `faction_rank:${type.name}`,
|
|
149
|
+
kind: 'faction_rank',
|
|
150
|
+
subkind: type.name,
|
|
151
|
+
target: DEFAULT_RANK_LADDER_SETS,
|
|
152
|
+
levels: DEFAULT_RANK_LEVELS,
|
|
153
|
+
groupPrefix: `group_faction_${String(fi + 1).padStart(2, '0')}_rank`,
|
|
154
|
+
label: `${type.name} · 职务阶梯`,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// 其余 kind 走普通池。
|
|
160
|
+
for (const kind of selected) {
|
|
161
|
+
if (handled.has(kind + '\u0000')) continue;
|
|
162
|
+
if (ABILITY_POOL_KINDS.includes(kind)) continue;
|
|
163
|
+
if (ABILITY_CORE_KINDS.includes(kind)) continue;
|
|
164
|
+
if (FACTION_POOL_KINDS.includes(kind)) continue;
|
|
165
|
+
if (kind === 'power_rank' || kind === 'faction_rank') continue;
|
|
166
|
+
addKind(kind, {
|
|
167
|
+
target: kind === 'world_rule' ? DEFAULT_WORLD_RULE_TARGET : surfaceTarget,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return items;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function planGenerationQueue(items = []) {
|
|
175
|
+
const all = (Array.isArray(items) ? items : []).map((item) => ({
|
|
176
|
+
...item,
|
|
177
|
+
generated: 0,
|
|
178
|
+
remaining: Math.max(0, Number(item.target) || 0),
|
|
179
|
+
status: Number(item.target) > 0 ? 'pending' : 'done',
|
|
180
|
+
batches: 0,
|
|
181
|
+
imported: 0,
|
|
182
|
+
db_existing: 0,
|
|
183
|
+
reason: '',
|
|
184
|
+
}));
|
|
185
|
+
return {
|
|
186
|
+
all,
|
|
187
|
+
pending: all.filter((item) => item.remaining > 0),
|
|
188
|
+
completed: all.filter((item) => item.remaining === 0),
|
|
189
|
+
};
|
|
190
|
+
}
|
|
@@ -61,7 +61,16 @@
|
|
|
61
61
|
"visual_motifs": ["视觉母题 1", "视觉母题 2"],
|
|
62
62
|
"naming_logic": "这个世界的人如何命名等级、技能、组织、物品",
|
|
63
63
|
"core_genres": ["必须包含全部选中题材"],
|
|
64
|
-
"
|
|
64
|
+
"ability_categories": [
|
|
65
|
+
{ "name": "能力类别名", "description": "这个类别的共同来源/视觉/代价" }
|
|
66
|
+
],
|
|
67
|
+
"faction_types": [
|
|
68
|
+
{ "name": "势力类型名", "description": "这类势力的共同气质/组织方式" }
|
|
69
|
+
],
|
|
70
|
+
"power_systems": [
|
|
71
|
+
{ "name": "力量体系名", "description": "这套等级体系的核心逻辑" }
|
|
72
|
+
],
|
|
73
|
+
"supported_kinds": ["person_name", "ability_name", "faction_name", "item_name", "world_rule"],
|
|
65
74
|
"suggestion_fit": "它如何兑现 direction_title 和 positioning",
|
|
66
75
|
"difference": "与另外两个候选的核心差异"
|
|
67
76
|
}
|
|
@@ -75,6 +84,7 @@
|
|
|
75
84
|
- `world_rules` 至少 3 条,必须能推出素材,不是空泛口号。
|
|
76
85
|
- `cost` 必须具体到日常动作或关系后果。
|
|
77
86
|
- `naming_logic` 要说明“等级/技能/组织/物品”各自的命名语法,不要只写“有古风感”。
|
|
87
|
+
- `ability_categories`、`faction_types`、`power_systems` 至少各 1 个;每个候选的世界要有可继续拆成 50 条池子的类别。
|
|
78
88
|
- 三个候选的 `core_conflict`、`power_source`、`cost` 至少有两项明显不同。
|
|
79
89
|
- 写完后只回复:已写入 <目标文件路径>。
|
|
80
90
|
|
|
@@ -107,7 +107,7 @@ async function databaseStyles(db) {
|
|
|
107
107
|
return rows.map((row) => normalizeStyle({ ...row, origin: 'database' }, 'database'))
|
|
108
108
|
.filter((style) => style.style_key);
|
|
109
109
|
} catch {
|
|
110
|
-
// 旧库还没执行 schema
|
|
110
|
+
// 旧库还没执行 schema v14 时不应阻断生成。
|
|
111
111
|
return [];
|
|
112
112
|
}
|
|
113
113
|
}
|
|
@@ -36,14 +36,14 @@ export function helpText() {
|
|
|
36
36
|
/fancy-material help 显示本帮助
|
|
37
37
|
|
|
38
38
|
说明:
|
|
39
|
-
- 素材是原子积木,每条有 id / kind / name / tags / genres / group_id / subkind / note / source
|
|
39
|
+
- 素材是原子积木,每条有 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / source;世界/组/等级序号可选。
|
|
40
40
|
- 素材库还支持 subject / tropes / narrative / traits / roles / relations / moods / settings 等多层 facet;它们主要由 fancy-douyin 分析结果填充,fancy-material 生成时可省略。
|
|
41
41
|
- subkind 是 kind 下的二级分类(例如 kind=特殊体质,subkind=病理变异);用于同一 kind 内再分组。
|
|
42
42
|
- note 可选,最多 300 字;都市类地名/势力/能力名优先写内层身份,表层伪装名写 note。
|
|
43
43
|
- 命名/措辞按题材文化体系适配:东方仙侠用诀/式/法/印,都市高武用令/条/章/程,西幻用契/印/律/颂,科幻用协议/阈值/序列,历史用司/署/营/旗,悬疑用规则/现象/编号,言情以意象词为主。
|
|
44
44
|
- 禁止用质量评价词做 tags:精品、高价值、文笔好、强力、神秘。
|
|
45
45
|
- tags 和 genres 都是数组:tags 3–8 个,genres 1–10 个;一个素材可以同时适配多个题材/标签。
|
|
46
|
-
-
|
|
46
|
+
- 每次运行默认每个表面素材池新增 50 条;能力/势力每个类别各 50 条;能力核心和等级阶梯按套生成。每批最多 10 条。
|
|
47
47
|
- facet 多选是**交集**:同一层选中的每一项都必须同时满足,不是任选其一。例如题材选 都市+异能+脑洞,素材必须同时满足三种。
|
|
48
48
|
- 选「都市异能」会同时按「都市」和「异能」处理;选「悬疑脑洞」会同时按「悬疑」和「脑洞」处理,两个条件都必须满足。
|
|
49
49
|
- 题材/方向/定位来自 _novel_topic_suggestion.json 时只做推荐值;用户本次选择优先,fancy-material 不修改该文件。
|
|
@@ -67,7 +67,7 @@ ${genreBlock}
|
|
|
67
67
|
${kindBlock}`;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
export const DEFAULT_TARGET_PER_KIND =
|
|
70
|
+
export const DEFAULT_TARGET_PER_KIND = 50;
|
|
71
71
|
export const DEFAULT_BATCH_SIZE = 10;
|
|
72
72
|
|
|
73
73
|
/**
|
|
@@ -92,7 +92,7 @@ function compactRules(genres, queryScript, workspace, sourceFixed = 'builtin') {
|
|
|
92
92
|
'- 只写本批指定的一个 kind;不要把其它 kind 混进同一个文件。',
|
|
93
93
|
'- 每条必须独立、具体、可复用;拒绝“火红、耀眼、神秘、强大”这类空泛词。',
|
|
94
94
|
'- 命名类必须有具体锚点;拒绝“复原眼、章眼、旧仓单、神秘剑、黑色长刀”这类废名。',
|
|
95
|
-
'- 字段只能是 id / kind / name / tags / genres / group_id / subkind / note / source;'
|
|
95
|
+
'- 字段只能是 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / source;'
|
|
96
96
|
+ 'source 写 ' + sourceFixed + ';tags 3–8 个,genres 1–10 个。',
|
|
97
97
|
'- tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去;'
|
|
98
98
|
+ '例如「都市高武」可以写 tags: ["都市","高武","都市高武", ...]。',
|
|
@@ -142,6 +142,9 @@ export function generationPrompt({
|
|
|
142
142
|
styleSummary = '',
|
|
143
143
|
worldBlock = '',
|
|
144
144
|
worldSummary = '',
|
|
145
|
+
subkind = '',
|
|
146
|
+
groupId = '',
|
|
147
|
+
worldId = '',
|
|
145
148
|
}) {
|
|
146
149
|
const lines = [];
|
|
147
150
|
if (includeBase && base) {
|
|
@@ -196,6 +199,9 @@ export function generationPrompt({
|
|
|
196
199
|
const label = kindLabel ? '(' + kindLabel + ')' : '';
|
|
197
200
|
lines.push('- kind 队列:第 ' + kindIndex + ' / ' + kindTotal + ' 个');
|
|
198
201
|
lines.push('- 本批 kind:`' + kind + '`' + label);
|
|
202
|
+
if (subkind) lines.push('- 本批 subkind:`' + subkind + '`(同一批所有记录都必须写这个 subkind)');
|
|
203
|
+
if (groupId) lines.push('- 本批 group_id:`' + groupId + '`(同一批所有记录都必须写这个 group_id)');
|
|
204
|
+
if (worldId) lines.push('- 本批 world_id:`' + worldId + '`(同一批所有记录都必须写这个 world_id)');
|
|
199
205
|
lines.push('- 本次该 kind 配额:' + targetPerKind + ' 条(追加到数据库,不是库内上限)');
|
|
200
206
|
lines.push('- 本次已生成:' + generated + ' 条');
|
|
201
207
|
lines.push('- 本次还需:' + Math.max(0, targetPerKind - generated) + ' 条');
|
|
@@ -220,13 +226,16 @@ export function generationPrompt({
|
|
|
220
226
|
|
|
221
227
|
lines.push('');
|
|
222
228
|
lines.push('写入要求:');
|
|
223
|
-
lines.push('1. 只把 JSONL 写进目标文件,一行一个对象;字段只能是 id / kind / name / tags / genres / group_id / subkind / note / source,source 固定写 ' + sourceFixed + '。tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去(例如 都市高武 → 都市、高武、都市高武)。');
|
|
229
|
+
lines.push('1. 只把 JSONL 写进目标文件,一行一个对象;字段只能是 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / source,source 固定写 ' + sourceFixed + '。tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去(例如 都市高武 → 都市、高武、都市高武)。');
|
|
224
230
|
lines.push('2. 命名/措辞/体例必须匹配题材文化体系,禁止跨题材串用后缀;都市类地名/势力/能力名优先写内层身份,表层日常伪装名写 note(最多 300 字)。');
|
|
225
231
|
lines.push('2.1 本次 facet 是交集:同一层多选全部同时成立;素材必须同时满足所有选中层,不能只取一部分。选中的 tropes / moods / settings / roles / relations 要原样写进对应数组。');
|
|
226
232
|
lines.push('3. tags 不能用质量评价词:精品、高价值、文笔好、强力、神秘。');
|
|
227
233
|
lines.push('4. 不要在文件里写 Markdown 代码围栏、标题、解释、前后缀。');
|
|
228
234
|
lines.push('5. 可以直接写 JSONL,也可以使用 Python/Node 生成器;生成器放 <工作区>/.tmp/,输出必须是目标 JSONL。');
|
|
229
235
|
lines.push('6. 本批文件只放本批素材;数据库导入只追加,不会覆盖已有素材。');
|
|
236
|
+
if (worldId) lines.push('6.1 每条记录必须写 world_id: `' + worldId + '`。');
|
|
237
|
+
if (subkind) lines.push('6.2 每条记录必须写 subkind: `' + subkind + '`。');
|
|
238
|
+
if (groupId) lines.push('6.3 每条记录必须写 group_id: `' + groupId + '`。');
|
|
230
239
|
lines.push('7. 生成前先用查询脚本/索引检查候选名字;同 kind 同 name 已存在就换一个。');
|
|
231
240
|
lines.push('8. 写完后运行 validate.js;失败就按错误修正,直到通过。');
|
|
232
241
|
lines.push('9. 不要自己运行导入命令;插件会负责最终校验、按 kind+name 去重并追加导入。');
|
|
@@ -251,6 +260,160 @@ export function generationPrompt({
|
|
|
251
260
|
return lines.join('\n');
|
|
252
261
|
}
|
|
253
262
|
|
|
263
|
+
|
|
264
|
+
function groupHeader({ base, includeBase, worldSummary, styleSummary, modes = '' }) {
|
|
265
|
+
const lines = [];
|
|
266
|
+
if (includeBase && base) {
|
|
267
|
+
lines.push(String(base || '').trim(), '', '---', '');
|
|
268
|
+
} else {
|
|
269
|
+
lines.push('## 继续生成(同一素材库)', '');
|
|
270
|
+
lines.push('继续遵守最初提示词中的角色、写作原则、质量红线、命名标准、描写标准、查询与追加规则。不要重新解释规则,直接写本批素材。', '');
|
|
271
|
+
if (worldSummary) lines.push('## 本批世界母体锁定(必须保持)', '', worldSummary, '');
|
|
272
|
+
}
|
|
273
|
+
if (styleSummary) lines.push('## 本批风格锁定(必须保持)', '', styleSummary, '');
|
|
274
|
+
if (modes) lines.push(modes, '');
|
|
275
|
+
return lines;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
function groupTail({ attempt, failures, target, validateScript, queryScript, existingIndex, existingTotal }) {
|
|
279
|
+
const lines = [];
|
|
280
|
+
if (validateScript) lines.push('- 格式校验脚本:`' + validateScript + '`');
|
|
281
|
+
if (queryScript) lines.push('- 查询脚本:`' + queryScript + '`');
|
|
282
|
+
if (existingIndex) lines.push('- 已有素材索引:`' + existingIndex + '`');
|
|
283
|
+
if (Number.isFinite(existingTotal)) lines.push('- 本次题材下已有素材:' + existingTotal + ' 条');
|
|
284
|
+
lines.push('');
|
|
285
|
+
lines.push('写入要求:');
|
|
286
|
+
lines.push('1. 只把 JSONL 写进目标文件,一行一个对象;不要 Markdown 围栏、标题、解释、前后缀。');
|
|
287
|
+
lines.push('2. 同一批所有记录必须属于同一组,使用同一个 `group_id`、同一个 `subkind` 和同一个 `world_id`。');
|
|
288
|
+
lines.push('3. tags 3–8 个;genres 必须原样包含本次全部题材,缺一个都算废稿;source 固定写 builtin。');
|
|
289
|
+
lines.push('4. tags 不能用质量评价词:精品、高价值、文笔好、强力、神秘。');
|
|
290
|
+
lines.push('5. 写完后运行 validate.js;失败就按错误修正,直到通过。');
|
|
291
|
+
lines.push('6. 不要自己运行导入命令;插件会负责校验和追加导入。');
|
|
292
|
+
lines.push('7. 写完后只回复:已写入 <目标文件路径>;然后结束本轮。');
|
|
293
|
+
if (attempt > 1) {
|
|
294
|
+
lines.push('', '## 上次文件没有通过校验', '');
|
|
295
|
+
const list = Array.isArray(failures) ? failures : [failures];
|
|
296
|
+
for (const failure of list) {
|
|
297
|
+
const content = String(failure || '').trim();
|
|
298
|
+
if (content) lines.push('```text', content, '```');
|
|
299
|
+
}
|
|
300
|
+
lines.push('', '请只修正上面这些问题,重新写入同一个目标文件;不要把已经正确的素材删掉重写。');
|
|
301
|
+
}
|
|
302
|
+
return lines;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export function abilityCorePrompt({
|
|
306
|
+
base,
|
|
307
|
+
target,
|
|
308
|
+
workspace,
|
|
309
|
+
batchId,
|
|
310
|
+
attempt = 1,
|
|
311
|
+
failures = [],
|
|
312
|
+
genres = [],
|
|
313
|
+
category = '',
|
|
314
|
+
groupId = '',
|
|
315
|
+
worldId = '',
|
|
316
|
+
targetSets = 3,
|
|
317
|
+
generatedSets = 0,
|
|
318
|
+
requestSets = 1,
|
|
319
|
+
includeBase = true,
|
|
320
|
+
validateScript,
|
|
321
|
+
queryScript,
|
|
322
|
+
existingIndex,
|
|
323
|
+
existingTotal,
|
|
324
|
+
styleSummary = '',
|
|
325
|
+
worldBlock = '',
|
|
326
|
+
worldSummary = '',
|
|
327
|
+
}) {
|
|
328
|
+
const lines = groupHeader({
|
|
329
|
+
base,
|
|
330
|
+
includeBase,
|
|
331
|
+
worldSummary,
|
|
332
|
+
styleSummary,
|
|
333
|
+
modes: '## 本批是能力核心组(允许 6 个 kind,必须成套)\n\n'
|
|
334
|
+
+ '本次不要按单 kind 写。你要生成一套完整的能力核心,恰好 6 条记录,六条互相解释同一个能力。',
|
|
335
|
+
});
|
|
336
|
+
lines.push('## 本次运行', '');
|
|
337
|
+
lines.push('- 工作区目录:' + workspace);
|
|
338
|
+
lines.push('- 目标文件(**绝对路径**):`' + target + '`');
|
|
339
|
+
lines.push('- 批次 ID:`' + batchId + '`');
|
|
340
|
+
lines.push('- 能力类别:`' + category + '`');
|
|
341
|
+
lines.push('- 固定 group_id:`' + groupId + '`');
|
|
342
|
+
lines.push('- 固定 subkind:`' + category + '`');
|
|
343
|
+
lines.push('- 固定 world_id:`' + worldId + '`');
|
|
344
|
+
lines.push('- 本次目标:' + targetSets + ' 套;已生成:' + generatedSets + ' 套;本批写:' + requestSets + ' 套');
|
|
345
|
+
lines.push('- 本批要写:**恰好 6 条记录**,kind 必须分别是:');
|
|
346
|
+
lines.push(' - `ability_mechanism`(机制)');
|
|
347
|
+
lines.push(' - `ability_activation`(发动条件)');
|
|
348
|
+
lines.push(' - `ability_cost`(代价)');
|
|
349
|
+
lines.push(' - `ability_limit`(限制)');
|
|
350
|
+
lines.push(' - `ability_counter`(反制)');
|
|
351
|
+
lines.push(' - `power_source`(力量来源)');
|
|
352
|
+
lines.push('- 六条必须指向同一个能力、同一套规则;机制、代价、限制、反制要能互相对上。');
|
|
353
|
+
lines.push('- 每条都要有 `name`、`tags`、`genres`、`note`;`note` 写具体后果,不写空泛说明。');
|
|
354
|
+
if (Array.isArray(genres) && genres.length) {
|
|
355
|
+
lines.push('- genres 必须同时包含:' + genres.join('、'));
|
|
356
|
+
}
|
|
357
|
+
lines.push('');
|
|
358
|
+
lines.push(...groupTail({ attempt, failures, target, validateScript, queryScript, existingIndex, existingTotal }));
|
|
359
|
+
return lines.join('\n');
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export function rankLadderPrompt({
|
|
363
|
+
base,
|
|
364
|
+
target,
|
|
365
|
+
workspace,
|
|
366
|
+
batchId,
|
|
367
|
+
attempt = 1,
|
|
368
|
+
failures = [],
|
|
369
|
+
genres = [],
|
|
370
|
+
kind = 'power_rank',
|
|
371
|
+
kindLabel = '',
|
|
372
|
+
subkind = '',
|
|
373
|
+
groupId = '',
|
|
374
|
+
worldId = '',
|
|
375
|
+
targetSets = 3,
|
|
376
|
+
generatedSets = 0,
|
|
377
|
+
requestSets = 1,
|
|
378
|
+
levels = 10,
|
|
379
|
+
includeBase = true,
|
|
380
|
+
validateScript,
|
|
381
|
+
queryScript,
|
|
382
|
+
existingIndex,
|
|
383
|
+
existingTotal,
|
|
384
|
+
styleSummary = '',
|
|
385
|
+
worldBlock = '',
|
|
386
|
+
worldSummary = '',
|
|
387
|
+
}) {
|
|
388
|
+
const lines = groupHeader({
|
|
389
|
+
base,
|
|
390
|
+
includeBase,
|
|
391
|
+
worldSummary,
|
|
392
|
+
styleSummary,
|
|
393
|
+
modes: '## 本批是等级阶梯(同一 kind,必须成套有序)\n\n'
|
|
394
|
+
+ '本次不要生成散装等级名。你要生成一套完整的等级阶梯,每级一条记录。',
|
|
395
|
+
});
|
|
396
|
+
lines.push('## 本次运行', '');
|
|
397
|
+
lines.push('- 工作区目录:' + workspace);
|
|
398
|
+
lines.push('- 目标文件(**绝对路径**):`' + target + '`');
|
|
399
|
+
lines.push('- 批次 ID:`' + batchId + '`');
|
|
400
|
+
lines.push('- 本批 kind:`' + kind + '`' + (kindLabel ? '(' + kindLabel + ')' : ''));
|
|
401
|
+
lines.push('- 体系/势力类型:`' + subkind + '`');
|
|
402
|
+
lines.push('- 固定 group_id:`' + groupId + '`');
|
|
403
|
+
lines.push('- 固定 subkind:`' + subkind + '`');
|
|
404
|
+
lines.push('- 固定 world_id:`' + worldId + '`');
|
|
405
|
+
lines.push('- 本次目标:' + targetSets + ' 套阶梯;已生成:' + generatedSets + ' 套;本批写:' + requestSets + ' 套');
|
|
406
|
+
lines.push('- 本批要写:一套 **8–12 级**的完整阶梯,建议 ' + levels + ' 级。');
|
|
407
|
+
lines.push('- 每条记录必须写 `rank_order`:最低级为 1,往上递增,不能断号、不能重复。');
|
|
408
|
+
lines.push('- `name` 是等级/职务名;`note` 写这一级的权责、门槛、待遇或代价;上下级关系要能看出来。');
|
|
409
|
+
if (Array.isArray(genres) && genres.length) {
|
|
410
|
+
lines.push('- genres 必须同时包含:' + genres.join('、'));
|
|
411
|
+
}
|
|
412
|
+
lines.push('');
|
|
413
|
+
lines.push(...groupTail({ attempt, failures, target, validateScript, queryScript, existingIndex, existingTotal }));
|
|
414
|
+
return lines.join('\n');
|
|
415
|
+
}
|
|
416
|
+
|
|
254
417
|
function formatDuration(ms) {
|
|
255
418
|
const total = Math.max(0, Math.round(Number(ms) || 0) / 1000);
|
|
256
419
|
const hours = Math.floor(total / 3600);
|
|
@@ -288,10 +451,10 @@ export function generationRunText({
|
|
|
288
451
|
: ((incomplete.length || notStarted.length || stopReason) ? '⚠️ 素材生成未全部完成' : '✅ 素材生成完成');
|
|
289
452
|
const lines = [
|
|
290
453
|
title,
|
|
291
|
-
'
|
|
454
|
+
'目标:表面素材池每个新增 ' + targetPerKind + ' 条;能力核心/等级阶梯按套生成;每批最多 ' + batchSize + ' 条',
|
|
292
455
|
'数据库:' + database,
|
|
293
456
|
];
|
|
294
|
-
if (queue.length) lines.push('本次队列:' + queue.length + '
|
|
457
|
+
if (queue.length) lines.push('本次队列:' + queue.length + ' 个项目');
|
|
295
458
|
if (completed.length) lines.push('本次完成:' + completed.length + ' 个 kind');
|
|
296
459
|
if (notStarted.length) lines.push('未开始:' + notStarted.length + ' 个 kind');
|
|
297
460
|
if (incomplete.length) {
|
|
@@ -13,7 +13,7 @@ import { MATERIAL_KINDS } from './kinds.js';
|
|
|
13
13
|
import { MATERIAL_FACET_FIELDS, MATERIAL_FACET_LIMITS, MATERIAL_TAG_LIMITS, MATERIAL_SUBJECT_MAX } from './facets.js';
|
|
14
14
|
|
|
15
15
|
const ALLOWED = new Set([
|
|
16
|
-
'id', 'kind', 'name', 'subject', 'tags', 'group_id', 'subkind', 'note', 'source',
|
|
16
|
+
'id', 'kind', 'name', 'subject', 'tags', 'group_id', 'subkind', 'world_id', 'rank_order', 'note', 'source',
|
|
17
17
|
...MATERIAL_FACET_FIELDS,
|
|
18
18
|
]);
|
|
19
19
|
const QUALITY_TAGS = new Set(['精品', '高价值', '文笔好', '强力', '神秘']);
|
|
@@ -29,7 +29,7 @@ function usage() {
|
|
|
29
29
|
|
|
30
30
|
检查:
|
|
31
31
|
- 一行一个合法 JSON 对象
|
|
32
|
-
- 字段只能是 id / kind / name / subject / tags / genres / tropes / narrative / traits / roles / relations / moods / settings / group_id / subkind / note / source
|
|
32
|
+
- 字段只能是 id / kind / name / subject / tags / genres / tropes / narrative / traits / roles / relations / moods / settings / world_id / group_id / subkind / rank_order / note / source
|
|
33
33
|
- source 只能是 builtin / other
|
|
34
34
|
- builtin 的 kind 必须在允许列表内,id 以 kind 开头
|
|
35
35
|
- other 的 kind 不受限制
|
|
@@ -105,6 +105,18 @@ function validate(raw, line) {
|
|
|
105
105
|
errors.push('第 ' + line + ' 行:subkind 不能超过 ' + SUBKIND_MAX + ' 字');
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
+
if (raw.world_id !== undefined) {
|
|
109
|
+
if (typeof raw.world_id !== 'string' || !raw.world_id.trim()) {
|
|
110
|
+
errors.push('第 ' + line + ' 行:world_id 必须是非空字符串');
|
|
111
|
+
} else if (raw.world_id.trim().length > 120) {
|
|
112
|
+
errors.push('第 ' + line + ' 行:world_id 不能超过 120 字符');
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (raw.rank_order !== undefined) {
|
|
116
|
+
if (!Number.isInteger(raw.rank_order) || raw.rank_order < 1) {
|
|
117
|
+
errors.push('第 ' + line + ' 行:rank_order 必须是正整数');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
108
120
|
if (raw.note !== undefined) {
|
|
109
121
|
if (typeof raw.note !== 'string') errors.push('第 ' + line + ' 行:note 必须是字符串');
|
|
110
122
|
else if (raw.note.length > NOTE_MAX) errors.push('第 ' + line + ' 行:note 不能超过 ' + NOTE_MAX + ' 字');
|