@cloud411716/fancy-webnovel 4.29.1 → 4.30.1

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.
@@ -99,18 +99,20 @@ export async function countByKind(root, genres) {
99
99
  * @param {string[]} genres selected genres; empty means all
100
100
  * @returns {Promise<number>}
101
101
  */
102
- export async function countKind(root, kind, genres) {
102
+ export async function countKind(root, kind, genres, subkind = '') {
103
103
  const { db } = await connectMaterial(root);
104
104
  try {
105
105
  const list = (genres || []).filter(Boolean);
106
+ const extra = subkind ? ' AND subkind = $subkind' : '';
107
+ const params = subkind ? { kind, genres: list, subkind } : { kind, genres: list };
106
108
  const rows = list.length
107
109
  ? await db.query(
108
- 'SELECT count() AS n FROM (SELECT VALUE id FROM material WHERE kind = $kind AND genres CONTAINSALL $genres) GROUP ALL;',
109
- { kind, genres: list },
110
+ 'SELECT count() AS n FROM (SELECT VALUE id FROM material WHERE kind = $kind AND genres CONTAINSALL $genres' + extra + ') GROUP ALL;',
111
+ params,
110
112
  )
111
113
  : await db.query(
112
- 'SELECT count() AS n FROM material WHERE kind = $kind GROUP ALL;',
113
- { kind },
114
+ 'SELECT count() AS n FROM material WHERE kind = $kind' + extra + ' GROUP ALL;',
115
+ params,
114
116
  );
115
117
  const row = Array.isArray(rows) && Array.isArray(rows[0]) ? rows[0][0] : null;
116
118
  return row ? Number(row.n) || 0 : 0;
@@ -10,8 +10,8 @@ export const KIND_GROUPS = [
10
10
  {
11
11
  title: '命名',
12
12
  kinds: [
13
- 'surname', 'given_name', 'nickname', 'place_name', 'faction_name',
14
- 'skill_name', 'ability_name', 'item_name', 'monster_name', 'mythic_being', 'rank_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
- * 构成 58 个 kind 的单一事实来源。help 只打印 kind + 中文名,提示词才展开
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
- 命名: ['surname', 'given_name', 'nickname', 'place_name', 'faction_name', 'skill_name', 'ability_name', 'item_name', 'monster_name', 'mythic_being', 'rank_name'],
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
- 物品: ['item_name', 'item_form', 'item_material', 'item_function', 'item_visual'],
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', 'conflict_seed', 'conflict_escalation', 'plot_twist', 'mystery_seed', 'payoff_scene', 'trope'],
275
- 姓名: ['surname', 'given_name'],
276
- 人名: ['surname', 'given_name', 'nickname'],
277
- 名字: ['given_name'],
278
- 姓氏: ['surname'],
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
- 境界: ['rank_name',],
304
- 等级: ['rank_name',],
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
- 冲突: ['conflict_seed'],
325
- 反转: ['plot_twist'],
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
- * - 素材类型可以不在 58 个 kind 里,模型可以自拟 kind;
444
+ * - 素材类型可以不在 55 个 kind 里,模型可以自拟 kind;
418
445
  * - 同一批只能用一个 kind,插件会在第一轮之后记住它。
419
446
  */
420
447
  export function customFocusBlock({ genre, materialType, kinds = [], allKinds = false }) {
@@ -441,3 +468,19 @@ export function customFocusBlock({ genre, materialType, kinds = [], allKinds = f
441
468
  - genres 必须原样包含用户题材「${genre}」;可以再附加其它适用题材(1–5 个)。
442
469
  - 其他质量、查询、追加规则继续适用。`;
443
470
  }
471
+
472
+ /**
473
+ * 本批只渲染当前 kind 的专属要求,避免把全部 55 个 kind 都塞进每批提示词。
474
+ */
475
+ export function renderKindBlock(kind) {
476
+ const key = String(kind || '').trim();
477
+ if (!key) {
478
+ return '(本批未指定 kind;按本次运行说明执行。)';
479
+ }
480
+ return [
481
+ `本批只生成 \`${key}\`(${KIND_LABELS[key] || key})。`,
482
+ `- name 写什么:${DEFAULT_HINTS[key] || '按 kind 职责写一个最小信息点。'}`,
483
+ `- 质量要求:${KIND_QUALITY[key] || '具体、可读、有记忆点,不写空泛评价。'}`,
484
+ '- 只写这个 kind;不要混入其它 kind,也不要自行切换到下一个 kind。',
485
+ ].join('\n');
486
+ }
@@ -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
- "supported_kinds": ["rank_name", "skill_name", "faction_name", "item_name", "world_rule"],
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
 
@@ -41,6 +41,11 @@ function normalizeStyle(raw, origin = 'database') {
41
41
  const style = raw && typeof raw === 'object' ? raw : {};
42
42
  const profile = asObject(style.profile_json);
43
43
  const merged = { ...profile, ...style };
44
+ const crossKindExamples = asObject(merged.cross_kind_examples);
45
+ if (crossKindExamples.rank_name && !crossKindExamples.power_rank) {
46
+ crossKindExamples.power_rank = crossKindExamples.rank_name;
47
+ }
48
+ delete crossKindExamples.rank_name;
44
49
  return {
45
50
  style_key: String(merged.style_key || '').trim(),
46
51
  style_name: String(merged.style_name || merged.name || merged.style_key || '').trim(),
@@ -57,9 +62,15 @@ function normalizeStyle(raw, origin = 'database') {
57
62
  ].map((v) => String(v || '').trim()).filter(Boolean)),
58
63
  genre_tags: unique(asArray(merged.genre_tags).map((v) => String(v || '').trim())),
59
64
  dna: String(merged.dna || '').trim(),
65
+ naming_mode: ['image', 'hybrid', 'identifier'].includes(String(merged.naming_mode || '').trim())
66
+ ? String(merged.naming_mode).trim()
67
+ : '',
68
+ generation_chain: unique(asArray(merged.generation_chain).map((v) => String(v || '').trim())),
69
+ image_pool: unique(asArray(merged.image_pool).map((v) => String(v || '').trim())),
70
+ hook_rule: String(merged.hook_rule || '').trim(),
60
71
  naming_rules: asObject(merged.naming_rules),
61
72
  lexicon: asObject(merged.lexicon),
62
- cross_kind_examples: asObject(merged.cross_kind_examples),
73
+ cross_kind_examples: crossKindExamples,
63
74
  anti_examples: unique(asArray(merged.anti_examples).map((v) => String(v || '').trim())),
64
75
  compatibility: asObject(merged.compatibility),
65
76
  confidence: Math.max(0, Math.min(1, Number(merged.confidence) || 0)),
@@ -84,6 +95,10 @@ function mergeStyle(base, patch) {
84
95
  account_urls: unique([...a.account_urls, ...b.account_urls]),
85
96
  genre_tags: unique([...a.genre_tags, ...b.genre_tags]),
86
97
  dna: b.dna || a.dna,
98
+ naming_mode: b.naming_mode || a.naming_mode,
99
+ generation_chain: unique([...a.generation_chain, ...b.generation_chain]),
100
+ image_pool: unique([...a.image_pool, ...b.image_pool]),
101
+ hook_rule: b.hook_rule || a.hook_rule,
87
102
  naming_rules: mergeObject(a.naming_rules, b.naming_rules),
88
103
  lexicon: mergeObject(a.lexicon, b.lexicon),
89
104
  cross_kind_examples: mergeObject(a.cross_kind_examples, b.cross_kind_examples),
@@ -107,7 +122,7 @@ async function databaseStyles(db) {
107
122
  return rows.map((row) => normalizeStyle({ ...row, origin: 'database' }, 'database'))
108
123
  .filter((style) => style.style_key);
109
124
  } catch {
110
- // 旧库还没执行 schema v13 时不应阻断生成。
125
+ // 旧库还没执行 schema v14 时不应阻断生成。
111
126
  return [];
112
127
  }
113
128
  }
@@ -287,7 +302,6 @@ export function styleIndexLines(styles, { limit = 20 } = {}) {
287
302
  * 只展开本次选中的风格;其余只给索引,避免上下文爆炸。
288
303
  */
289
304
  export function stylePromptBlock(styles, selected, { genres = [] } = {}) {
290
- const all = Array.isArray(styles) ? styles : [];
291
305
  const picked = Array.isArray(selected) ? selected : [];
292
306
  const lines = [
293
307
  '## 风格锁定(最高优先级)',
@@ -295,12 +309,9 @@ export function stylePromptBlock(styles, selected, { genres = [] } = {}) {
295
309
  '风格是跨 kind 的不变量:kind 决定“写什么信息点”,风格决定“用什么方式写”。',
296
310
  '如果下面的风格规则与题材命名体例冲突,以风格规则为准;题材只负责换词汇和禁用项。',
297
311
  '',
298
- '### 可用风格索引',
299
- ...styleIndexLines(all),
300
- '',
301
312
  ];
302
313
  if (!picked.length) {
303
- lines.push('本次未选择账号风格,按通用规则生成。');
314
+ lines.push('本次未选择账号风格,按通用规则生成;命名模式默认 image。');
304
315
  return lines.join('\n');
305
316
  }
306
317
  lines.push('### 本次选中的风格');
@@ -308,8 +319,17 @@ export function stylePromptBlock(styles, selected, { genres = [] } = {}) {
308
319
  lines.push('');
309
320
  lines.push(`#### \`${style.style_key}\`(${style.style_name})`);
310
321
  lines.push('- 风格类型:' + style.style_type);
322
+ lines.push('- 命名模式:`' + (style.naming_mode || 'image') + '`');
311
323
  lines.push('- 适用题材:' + (style.genre_tags || []).join('、'));
312
324
  lines.push('- DNA:' + style.dna);
325
+ if (style.generation_chain && style.generation_chain.length) {
326
+ lines.push('- 生成链路:');
327
+ for (const step of style.generation_chain) lines.push(' - ' + step);
328
+ }
329
+ if (style.image_pool && style.image_pool.length) {
330
+ lines.push('- 母题意象池:' + style.image_pool.join('、'));
331
+ }
332
+ if (style.hook_rule) lines.push('- 钩子要求:' + style.hook_rule);
313
333
  const rules = style.naming_rules || {};
314
334
  if (rules.length) lines.push('- 长度:' + (Array.isArray(rules.length) ? rules.length.join('–') + ' 字' : rules.length));
315
335
  if (rules.syntax) lines.push('- 句式:' + asArray(rules.syntax).join(';'));
@@ -331,7 +351,7 @@ export function stylePromptBlock(styles, selected, { genres = [] } = {}) {
331
351
  }
332
352
  lines.push('');
333
353
  lines.push('本批题材:' + (genres.join('、') || '通用'));
334
- lines.push('把选中风格的“核心语法”投射到本次题材和本批 kind 上;不要照抄正例,也不要退回通用仙气/古风形容词。');
354
+ lines.push('严格按选中风格的 `naming_mode` 和生成链路执行;不要自行切换风格或命名模式。');
335
355
  return lines.join('\n');
336
356
  }
337
357
 
@@ -425,6 +445,10 @@ export async function upsertStyleProfiles(db, profiles, { account = null } = {})
425
445
  profile_json: {
426
446
  account_names: merged.account_names,
427
447
  account_urls: merged.account_urls,
448
+ naming_mode: merged.naming_mode,
449
+ generation_chain: merged.generation_chain,
450
+ image_pool: merged.image_pool,
451
+ hook_rule: merged.hook_rule,
428
452
  naming_rules: merged.naming_rules,
429
453
  lexicon: merged.lexicon,
430
454
  cross_kind_examples: merged.cross_kind_examples,