@cloud411716/fancy-webnovel 4.30.0 → 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.
- package/docs/material-library/backlog.md +132 -0
- package/docs/material-library/prompt-v2.md +729 -0
- package/docs/material-library/prompt-v3.md +202 -0
- package/docs/material-library/prompt.md +140 -467
- package/package.json +1 -1
- package/plugins/fancy-material/builtin-styles.js +30 -14
- package/plugins/fancy-material/genre-playbooks.js +98 -0
- package/plugins/fancy-material/index.js +30 -2
- package/plugins/fancy-material/kinds.js +16 -0
- package/plugins/fancy-material/styles.js +31 -7
package/package.json
CHANGED
|
@@ -16,6 +16,10 @@ export const BUILTIN_STYLES = [
|
|
|
16
16
|
account_names: ['宿辞'],
|
|
17
17
|
genre_tags: ['仙侠', '古风', '悬疑', '志怪', '言情'],
|
|
18
18
|
dna: '短、含蓄、谜面式;古典留白;克制不张扬;名字像一句没说完的话。',
|
|
19
|
+
naming_mode: 'image',
|
|
20
|
+
generation_chain: ['抓一个情绪缺口或未尽之事', '把话停在半截,不解释完整', '名字只保留意象/状态,规则藏进 note'],
|
|
21
|
+
image_pool: ['灯', '骨', '纸', '镜', '棺', '香', '渡', '雪', '灰', '门', '影'],
|
|
22
|
+
hook_rule: '名字要像一句没说完的话,读者会想问“后来呢”。',
|
|
19
23
|
naming_rules: {
|
|
20
24
|
length: [2, 4],
|
|
21
25
|
syntax: ['意象+意象', '动词+宾语', '名词+状态'],
|
|
@@ -33,7 +37,7 @@ export const BUILTIN_STYLES = [
|
|
|
33
37
|
skill_name: ['问骨', '换灯', '借命'],
|
|
34
38
|
item_name: ['无字灯', '半面镜', '空棺钉'],
|
|
35
39
|
monster_name: ['背灯人', '无舌僧'],
|
|
36
|
-
|
|
40
|
+
power_rank: ['点灯', '守夜', '收骨'],
|
|
37
41
|
world_rule: ['灯灭之前,不能回头。'],
|
|
38
42
|
},
|
|
39
43
|
anti_examples: ['无灯巷秘境', '借命诀', '问骨阵法', '幽冥灯域', '神秘古祠'],
|
|
@@ -47,6 +51,10 @@ export const BUILTIN_STYLES = [
|
|
|
47
51
|
account_names: ['疯狂小鱼'],
|
|
48
52
|
genre_tags: ['仙侠', '玄幻', '悬疑', '都市', '幻境'],
|
|
49
53
|
dna: '意象拼接式命名;名字是场景而不是技能;偏幻境、水域、梦境、轮回、归墟;空灵留白。',
|
|
54
|
+
naming_mode: 'image',
|
|
55
|
+
generation_chain: ['选一个带边界/生死/梦境属性的母题意象', '给它一层可逆、朦胧的轮回规则', '名字只保留意象,规则藏进 note'],
|
|
56
|
+
image_pool: ['海', '镜', '梦', '归墟', '渡', '潮', '雾', '星', '廊', '汀', '潭'],
|
|
57
|
+
hook_rule: '名字先给一处场景,note 再揭示“过不去/回不来”的规则。',
|
|
50
58
|
naming_rules: {
|
|
51
59
|
length: [2, 5],
|
|
52
60
|
syntax: ['意象+意象', '地点意象+状态', '动词+地点意象'],
|
|
@@ -64,7 +72,7 @@ export const BUILTIN_STYLES = [
|
|
|
64
72
|
skill_name: ['照夜潮', '梦回汀'],
|
|
65
73
|
item_name: ['雾隐川', '落星津'],
|
|
66
74
|
monster_name: ['沉钟客', '镜中鲤'],
|
|
67
|
-
|
|
75
|
+
power_rank: ['入梦', '渡潮', '归墟'],
|
|
68
76
|
world_rule: ['梦醒之前,名字不能被第二个人听见。'],
|
|
69
77
|
},
|
|
70
78
|
anti_examples: ['沉眠海秘境', '归墟令', '镜花阵法', '梦境水域', '幽海幻境'],
|
|
@@ -78,6 +86,10 @@ export const BUILTIN_STYLES = [
|
|
|
78
86
|
account_names: ['Ael冷空气'],
|
|
79
87
|
genre_tags: ['科幻', '都市', '悬疑', '西幻', '哲思'],
|
|
80
88
|
dna: '抽象哲学/认知悖论;记忆、观测、虚妄、因果;冷、抽象、精神向;名字本身是一条未解的问题。',
|
|
89
|
+
naming_mode: 'image',
|
|
90
|
+
generation_chain: ['选一个认知悖论:观测、记忆、因果、自证', '让名字本身成为一个没有答案的问题', 'note 只给悖论的边界,不给标准答案'],
|
|
91
|
+
image_pool: ['观测', '记忆', '因果', '虚妄', '回声', '盲区', '校准', '悖论', '删除', '昨日'],
|
|
92
|
+
hook_rule: '名字读完后要让人停一下,意识到它不是在描述,而是在提问。',
|
|
81
93
|
naming_rules: {
|
|
82
94
|
length: [3, 6],
|
|
83
95
|
syntax: ['概念+悖论', '观测+对象', '抽象名词+状态'],
|
|
@@ -95,7 +107,7 @@ export const BUILTIN_STYLES = [
|
|
|
95
107
|
skill_name: ['观测坍缩', '记忆回溯', '因果让渡'],
|
|
96
108
|
item_name: ['被删除的昨天', '全知者残页'],
|
|
97
109
|
monster_name: ['观测者', '记忆寄生体'],
|
|
98
|
-
|
|
110
|
+
power_rank: ['观测者', '校准者', '归零者'],
|
|
99
111
|
world_rule: ['被观测到的事情,才允许发生。'],
|
|
100
112
|
},
|
|
101
113
|
anti_examples: ['观测异能', '记忆系统', '因果神功', '全知全能', '神秘观测者'],
|
|
@@ -109,6 +121,10 @@ export const BUILTIN_STYLES = [
|
|
|
109
121
|
account_names: ['充电进度条'],
|
|
110
122
|
genre_tags: ['都市', '悬疑', '科幻', '仙侠', '规则怪谈'],
|
|
111
123
|
dna: '日常事物 + 非常规规则;平凡物件/场所/职业叠加一层诡异或异能内核;必须让名字本身带“这东西不对劲”的钩子。',
|
|
124
|
+
naming_mode: 'hybrid',
|
|
125
|
+
generation_chain: ['找一个人人熟悉的日常系统:排队、打卡、电梯、排班', '抽取系统的底层运行逻辑,不写物品本身', '把逻辑升格为异能规则', '名字保留系统标识,不直接写效果'],
|
|
126
|
+
image_pool: ['电梯', '物业', '门禁', '打卡', '加班', '调休', '充电宝', '便利店', '末班车', '监控'],
|
|
127
|
+
hook_rule: '名字要像系统里的一个标识,note 才揭示这套系统被扭曲后的规则。',
|
|
112
128
|
naming_rules: {
|
|
113
129
|
length: [3, 8],
|
|
114
130
|
syntax: ['日常物件+规则限定', '场所/职业+异常属性', '制度词+超自然后果'],
|
|
@@ -126,7 +142,7 @@ export const BUILTIN_STYLES = [
|
|
|
126
142
|
skill_name: ['调休令', '超时加班', '打卡延命'],
|
|
127
143
|
item_name: ['过期门禁卡', '共享充电宝·第七号'],
|
|
128
144
|
monster_name: ['电梯保安', '物业经理'],
|
|
129
|
-
|
|
145
|
+
power_rank: ['实习生', '正式工', '项目经理', '业委会主任'],
|
|
130
146
|
world_rule: ['每晚 23:00,电梯会停靠不存在的负一层。'],
|
|
131
147
|
},
|
|
132
148
|
anti_examples: ['电梯', '业委会', '信号楼', '神秘电梯', '异能门禁', '物业法则'],
|
|
@@ -157,7 +173,7 @@ export const BUILTIN_STYLES = [
|
|
|
157
173
|
skill_name: ['一纸成威', '千锋聚', '封妖祟'],
|
|
158
174
|
item_name: ['凌云枪', '往生镰', '逍遥扇'],
|
|
159
175
|
monster_name: ['守道兽', '问心猿'],
|
|
160
|
-
|
|
176
|
+
power_rank: ['入道', '问心', '斩因', '坐忘'],
|
|
161
177
|
world_rule: ['选定一条道后,其他道的功法永久失效。'],
|
|
162
178
|
},
|
|
163
179
|
anti_examples: ['修仙选项A', '最强灵根', '无敌修派', '请选择之剑'],
|
|
@@ -188,7 +204,7 @@ export const BUILTIN_STYLES = [
|
|
|
188
204
|
skill_name: ['叫魂', '送纸', '压床'],
|
|
189
205
|
item_name: ['倒扣的碗', '不落地的伞'],
|
|
190
206
|
monster_name: ['床下客', '镜中婆'],
|
|
191
|
-
|
|
207
|
+
power_rank: ['守夜', '收惊', '送煞'],
|
|
192
208
|
world_rule: ['夜里听见有人叫全名,不能答应。'],
|
|
193
209
|
},
|
|
194
210
|
anti_examples: ['神秘禁忌', '民间法术大全', '上古诅咒', '诡异规则'],
|
|
@@ -219,7 +235,7 @@ export const BUILTIN_STYLES = [
|
|
|
219
235
|
skill_name: ['听雨', '折梅', '照影'],
|
|
220
236
|
item_name: ['半盏灯', '旧香囊'],
|
|
221
237
|
monster_name: ['雪狐', '灯下客'],
|
|
222
|
-
|
|
238
|
+
power_rank: ['听雪', '折花', '照影'],
|
|
223
239
|
world_rule: ['花开之前,不能说出她的名字。'],
|
|
224
240
|
},
|
|
225
241
|
anti_examples: ['古典意象系统', '唯美古风', '月华之力', '花语异能'],
|
|
@@ -250,7 +266,7 @@ export const BUILTIN_STYLES = [
|
|
|
250
266
|
skill_name: ['神格解读', '原典封印'],
|
|
251
267
|
item_name: ['M-007 镇魂匣', '封存档案·骨镜'],
|
|
252
268
|
monster_name: ['M-001 九尾狐', 'M-004 混沌'],
|
|
253
|
-
|
|
269
|
+
power_rank: ['未解密', '观测级', '封存级', '神话级'],
|
|
254
270
|
world_rule: ['档案被阅读一次,对应怪物就苏醒一级。'],
|
|
255
271
|
},
|
|
256
272
|
anti_examples: ['神秘怪物档案', '最强神兽录', '上古异兽大全'],
|
|
@@ -281,7 +297,7 @@ export const BUILTIN_STYLES = [
|
|
|
281
297
|
skill_name: ['养气', '产药', '周天'],
|
|
282
298
|
item_name: ['灵茶·松风', '灵膳·玉髓'],
|
|
283
299
|
monster_name: ['丹煞', '炉中魅'],
|
|
284
|
-
|
|
300
|
+
power_rank: ['炼气', '筑基', '产药', '结丹'],
|
|
285
301
|
world_rule: ['服丹之后三日之内,不能近女色,否则药力尽散。'],
|
|
286
302
|
},
|
|
287
303
|
anti_examples: ['道教系统', '修仙面板', '灵力等级', '魔法真气'],
|
|
@@ -312,7 +328,7 @@ export const BUILTIN_STYLES = [
|
|
|
312
328
|
skill_name: ['灵力破壳', '剑光分镜'],
|
|
313
329
|
item_name: ['青冥点星笔', '流云玉扇'],
|
|
314
330
|
monster_name: ['墨色黑龙', '白骨冥妃'],
|
|
315
|
-
|
|
331
|
+
power_rank: ['远景', '中景', '特写', '高光镜头'],
|
|
316
332
|
world_rule: ['每一次施法都必须有一个可拍摄的视觉锚点。'],
|
|
317
333
|
},
|
|
318
334
|
anti_examples: ['AI视觉系统', '分镜协议', '神兵模块'],
|
|
@@ -343,7 +359,7 @@ export const BUILTIN_STYLES = [
|
|
|
343
359
|
skill_name: ['烬烛回魂术', '残烬续命'],
|
|
344
360
|
item_name: ['霜羽扇', '扇骨·乌金'],
|
|
345
361
|
monster_name: ['烬兽', '熔岩生息'],
|
|
346
|
-
|
|
362
|
+
power_rank: ['圣体初显', '诸邪难侵', '大成成圣'],
|
|
347
363
|
world_rule: ['宗门以入门血契持续抽取弟子寿元,供长老延命。'],
|
|
348
364
|
},
|
|
349
365
|
anti_examples: ['血河体系统', '烬日秘境', '回魂术式'],
|
|
@@ -374,7 +390,7 @@ export const BUILTIN_STYLES = [
|
|
|
374
390
|
skill_name: ['规则改写', '时间借位'],
|
|
375
391
|
item_name: ['活体地图', '人皮地图'],
|
|
376
392
|
monster_name: ['观赏者', '不睡的孩子'],
|
|
377
|
-
|
|
393
|
+
power_rank: ['观察级', '收容级', '失效级'],
|
|
378
394
|
world_rule: ['看见规则的人,必须在一小时内把规则念给另一个人听。'],
|
|
379
395
|
},
|
|
380
396
|
anti_examples: ['神秘规则', '恐怖系统', '无限恐怖', '诡异空间'],
|
|
@@ -405,7 +421,7 @@ export const BUILTIN_STYLES = [
|
|
|
405
421
|
skill_name: ['荆棘回礼', '鸦羽替身'],
|
|
406
422
|
item_name: ['干枯玫瑰', '黑猫铃'],
|
|
407
423
|
monster_name: ['玫瑰寄生体', '无面知更鸟'],
|
|
408
|
-
|
|
424
|
+
power_rank: ['花苞', '盛放', '凋零'],
|
|
409
425
|
world_rule: ['收到玫瑰的人,会继承送花者的一段记忆。'],
|
|
410
426
|
},
|
|
411
427
|
anti_examples: ['玫瑰异能', '花语系统', '动物神功'],
|
|
@@ -436,7 +452,7 @@ export const BUILTIN_STYLES = [
|
|
|
436
452
|
skill_name: ['信息差写法', '章末钩子'],
|
|
437
453
|
item_name: ['大纲模板', '人物小传'],
|
|
438
454
|
monster_name: ['拖沓怪', '工具人配角'],
|
|
439
|
-
|
|
455
|
+
power_rank: ['新人', '签约', '万订'],
|
|
440
456
|
world_rule: ['每章结尾必须留下一个未解决的问题。'],
|
|
441
457
|
},
|
|
442
458
|
anti_examples: ['写作系统', '灵感面板', '文学理论大全'],
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 按本批题材动态注入的创作公式。
|
|
3
|
+
*
|
|
4
|
+
* 只渲染与本次选择相关的题材簇,避免把全部 34 个题材的规则塞进每一批。
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
const CLUSTERS = [
|
|
8
|
+
{
|
|
9
|
+
title: '玄幻仙侠',
|
|
10
|
+
aliases: ['仙侠', '修真', '玄幻', '东方仙侠', '传统玄幻', '玄幻脑洞', '玄幻言情', '都市修真', '洪荒', '封神', '西游'],
|
|
11
|
+
formula: '修仙体系规则 × 世俗行业逻辑:把宗门、修炼、丹器阵换成人间行业(账房、医馆、工程队、科举、商行、镖局)的底层规则。',
|
|
12
|
+
cliches: '废柴退婚、随身老爷爷、丹药全是极品、越级毫发无伤、反派全是智障、灵根只分五属性、秘境捡神装。',
|
|
13
|
+
directions: '修炼有折旧、功法有版权、宗门有 KPI、丹药有副作用、传承有债务。',
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
title: '都市异能',
|
|
17
|
+
aliases: ['都市', '异能', '脑洞', '都市高武', '都市脑洞', '都市日常', '都市种田', '战神赘婿', '超能力', '现代', '校园'],
|
|
18
|
+
formula: '市井日常运行规则 × 超自然能力规则:能力规则必须和日常物品/行为的原生逻辑一致,不是把物品当武器。',
|
|
19
|
+
cliches: '校花倒贴、透视眼、医圣兵王、无脑打脸、豪门认亲、系统无限抽奖、异能只有打打杀杀。',
|
|
20
|
+
directions: '能力有荒诞代价、超能力要遵守市井规矩、强者为日常琐事买单、异能是某种职业规则的延伸。',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
title: '西方奇幻与哲思',
|
|
24
|
+
aliases: ['西幻', '奇幻', '西方奇幻', '哲思', '克苏鲁', '神话'],
|
|
25
|
+
formula: '神话/哲学规则 × 世俗运行逻辑:把七宗罪、神性、契约、律法嫁接现代/中世纪日常规则,不是换皮打怪。',
|
|
26
|
+
cliches: '勇者斗恶龙、元素对轰、精灵矮人模板、开局废柴、系统召唤、神魔无脑站边。',
|
|
27
|
+
directions: '神力有代价、契约有漏洞、神性腐蚀人性、信仰是力量也是枷锁。',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
title: '科幻末世',
|
|
31
|
+
aliases: ['科幻', '末世', '赛博朋克', '蒸汽朋克', '废土', '星际', '游戏', '电竞', '游戏体育', '动漫衍生', '男频衍生'],
|
|
32
|
+
formula: '生存/竞技规则 × 经营管理逻辑:末世、游戏、竞技的压力和仓储、运维、排班、成本核算结合,爽点来自秩序建立。',
|
|
33
|
+
cliches: '无限空间无脑通关、末世全靠主角、丧尸背景板、系统送神装、队友全是拖油瓶。',
|
|
34
|
+
directions: '资源有折旧、据点有运维成本、生存有账期、胜利要付制度性代价。',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: '历史古代',
|
|
38
|
+
aliases: ['历史', '古代', '民国', '年代', '抗战', '谍战', '历史古代', '历史脑洞', '抗战谍战'],
|
|
39
|
+
formula: '历史背景规则 × 现代专业思维:用会计、工程、法律、传媒、医学等专业逻辑解决古代/近代问题,制造规则错位。',
|
|
40
|
+
cliches: '背古诗装逼、造玻璃肥皂一统天下、皇帝言听计从、后宫全收、金手指直接改历史。',
|
|
41
|
+
directions: '专业知识有时代局限、改革有阵痛、改变要付代价、历史惯性大于个人能力。',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
title: '言情情感',
|
|
45
|
+
aliases: ['言情', '古言', '现言', '青春', '甜宠', '虐恋', '豪门', '婚恋', '宫斗', '宅斗', '古风世情', '现言脑洞', '青春甜宠', '星光璀璨', '职场婚恋', '豪门总裁', '民国言情', '种田', '女频衍生'],
|
|
46
|
+
formula: '情感关系张力 × 身份/规则错位:感情拉扯来自身份、规则、立场的天然冲突,不靠误会和恶毒配角。',
|
|
47
|
+
cliches: '替身梗、带球跑、恶毒女配、霸总强制爱、误会一百章不解、落水必接吻、生病必照顾。',
|
|
48
|
+
directions: '感情有沉没成本、选择有取舍、相爱但立场对立、圆满也要付出代价。',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
title: '悬疑灵异',
|
|
52
|
+
aliases: ['悬疑', '灵异', '惊悚', '恐怖', '志怪', '民俗', '规则怪谈', '刑侦', '推理', '探案', '悬疑脑洞', '女频悬疑', '悬疑灵异'],
|
|
53
|
+
formula: '异常规则 × 日常场所运行逻辑:诡异现象遵循自洽规则,和日常场所秩序绑定;恐怖来自规则的未知性,不是血腥 jump scare。',
|
|
54
|
+
cliches: '红衣女鬼、精神病结局、做梦结局、祖传阴阳眼、道士做法秒破局、凶手全是变态。',
|
|
55
|
+
directions: '规则有漏洞也有代价、异常遵循特定逻辑、破解要付对等代价、真相比诡异更难受。',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
title: '宅斗快穿',
|
|
59
|
+
aliases: ['宫斗', '宅斗', '快穿', '宫斗宅斗'],
|
|
60
|
+
formula: '内宅/任务规则 × 职场/项目管理逻辑:把宅斗、快穿博弈换成绩效考核、项目交付、规则利用,不靠下毒打胎。',
|
|
61
|
+
cliches: '麝香打胎、落水失贞、姐妹反目、系统强制任务、宿主全能、反派全是蠢货。',
|
|
62
|
+
directions: '规矩就是武器、名分对应权责、任务有 KPI 也有坏账、通关要留后遗症。',
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
function clean(value) {
|
|
67
|
+
return String(value == null ? '' : value).trim();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function matches(genre, aliases) {
|
|
71
|
+
return aliases.some((alias) => genre === alias || genre.includes(alias) || alias.includes(genre));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function selectGenreClusters(genres = []) {
|
|
75
|
+
const selected = [...new Set((Array.isArray(genres) ? genres : []).map(clean).filter(Boolean))];
|
|
76
|
+
return CLUSTERS.filter((cluster) => selected.some((genre) => matches(genre, cluster.aliases)));
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* 只渲染本次相关题材簇。没有命中时给一段通用兜底,不输出全部题材规则。
|
|
81
|
+
*/
|
|
82
|
+
export function renderGenreBlock(genres = []) {
|
|
83
|
+
const selected = [...new Set((Array.isArray(genres) ? genres : []).map(clean).filter(Boolean))];
|
|
84
|
+
if (!selected.length) return '(本次未限制题材;按世界母体和本批 kind 要求执行。)';
|
|
85
|
+
const clusters = selectGenreClusters(selected);
|
|
86
|
+
if (!clusters.length) {
|
|
87
|
+
return '(本次题材未命中内置题材簇;以世界母体、facet 交集和本批 kind 要求为准,不要套用未选中的题材体例。)';
|
|
88
|
+
}
|
|
89
|
+
const lines = ['本次题材:' + selected.join('、')];
|
|
90
|
+
for (const cluster of clusters) {
|
|
91
|
+
lines.push('');
|
|
92
|
+
lines.push('### ' + cluster.title);
|
|
93
|
+
lines.push('- 创意公式:' + cluster.formula);
|
|
94
|
+
lines.push('- 俗套黑名单:' + cluster.cliches);
|
|
95
|
+
lines.push('- 可用方向:' + cluster.directions);
|
|
96
|
+
}
|
|
97
|
+
return lines.join('\n');
|
|
98
|
+
}
|
|
@@ -29,8 +29,9 @@ import { readMinimalTopic, readSuggestion } from '#material-topic';
|
|
|
29
29
|
import { makeWaitForTurn } from '../fancy-story-builder/writing-driver.js';
|
|
30
30
|
import { exportMaterials } from './exporter.js';
|
|
31
31
|
import { allKnownGenres } from './genres.js';
|
|
32
|
+
import { renderGenreBlock } from './genre-playbooks.js';
|
|
32
33
|
import { buildExistingIndex, countByKind, countKind } from './inventory.js';
|
|
33
|
-
import { KIND_LABELS, MATERIAL_KINDS, focusBlock, renderKindTable } from './kinds.js';
|
|
34
|
+
import { KIND_LABELS, MATERIAL_KINDS, focusBlock, renderKindBlock, renderKindTable } from './kinds.js';
|
|
34
35
|
import { loadStyleRegistry, selectStyles, styleBatchSummary, stylePromptBlock, styleSummaryText } from './styles.js';
|
|
35
36
|
import {
|
|
36
37
|
EMPTY_FACET_LABEL,
|
|
@@ -150,6 +151,8 @@ function renderBasePrompt({
|
|
|
150
151
|
styleBlock = '',
|
|
151
152
|
styleRules = '',
|
|
152
153
|
worldBlock = '',
|
|
154
|
+
kindBlock = '',
|
|
155
|
+
genreBlock = '',
|
|
153
156
|
audience = '',
|
|
154
157
|
}) {
|
|
155
158
|
const sourceFixed = mode === 'other' ? 'other' : 'builtin';
|
|
@@ -164,6 +167,8 @@ function renderBasePrompt({
|
|
|
164
167
|
GENRES: (genres || []).join('、') || '(未限制,按世界母体推导)',
|
|
165
168
|
TOPIC_FILE: topicFile || '(无)',
|
|
166
169
|
KIND_TABLE: renderKindTable(),
|
|
170
|
+
KIND_BLOCK: kindBlock || '(本批未指定 kind;按本次运行说明执行。)',
|
|
171
|
+
GENRE_BLOCK: genreBlock || '(本次未提供题材专属规则;按世界母体和 kind 要求执行。)',
|
|
167
172
|
FOCUS_BLOCK: focusBlockText || focusBlock(focus),
|
|
168
173
|
TARGET_PER_KIND: String(targetPerKind),
|
|
169
174
|
BATCH_SIZE: String(batchSize),
|
|
@@ -1102,6 +1107,24 @@ async function runContinue(ctx, invocation, session, taskList, opts = {}) {
|
|
|
1102
1107
|
});
|
|
1103
1108
|
}
|
|
1104
1109
|
|
|
1110
|
+
function kindBlockForItem(item) {
|
|
1111
|
+
if (!item) return '';
|
|
1112
|
+
if (item.mode === 'ability_core') {
|
|
1113
|
+
const list = Array.isArray(item.kinds) && item.kinds.length ? item.kinds : [];
|
|
1114
|
+
return [
|
|
1115
|
+
'本批是能力核心组:六条记录必须指向同一个能力,且互相解释。',
|
|
1116
|
+
...list.map((kind) => renderKindBlock(kind)),
|
|
1117
|
+
].join('\n\n');
|
|
1118
|
+
}
|
|
1119
|
+
if (item.mode === 'rank_ladder') {
|
|
1120
|
+
return [
|
|
1121
|
+
renderKindBlock(item.kind),
|
|
1122
|
+
'本批是一套完整等级阶梯:每级一条,rank_order 从 1 开始连续递增。',
|
|
1123
|
+
].join('\n\n');
|
|
1124
|
+
}
|
|
1125
|
+
return renderKindBlock(item.kind);
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1105
1128
|
export async function runGenerationWithPlan(ctx, invocation, session, taskList, opts = {}) {
|
|
1106
1129
|
const root = opts.root || workspaceOf(session);
|
|
1107
1130
|
const plan = opts.plan || {};
|
|
@@ -1177,7 +1200,7 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
1177
1200
|
const scopeBlockText = '本次世界母体生成范围:'
|
|
1178
1201
|
+ planned.all.map((item) => `\`${item.kind || item.mode}\`(${item.label})`).join('、')
|
|
1179
1202
|
+ '。插件只按这个范围排队;不要生成未选中的 kind。';
|
|
1180
|
-
const
|
|
1203
|
+
const baseForItem = (item) => renderBasePrompt({
|
|
1181
1204
|
mode: 'world',
|
|
1182
1205
|
genres,
|
|
1183
1206
|
topicFile: plan.topicFile || '(无)',
|
|
@@ -1194,6 +1217,8 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
1194
1217
|
styleBlock,
|
|
1195
1218
|
styleRules,
|
|
1196
1219
|
worldBlock,
|
|
1220
|
+
kindBlock: kindBlockForItem(item),
|
|
1221
|
+
genreBlock: renderGenreBlock(genres),
|
|
1197
1222
|
});
|
|
1198
1223
|
|
|
1199
1224
|
// 先统计已有数量,再进入队列。
|
|
@@ -1377,6 +1402,7 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
1377
1402
|
|
|
1378
1403
|
for (let index = 0; index < pending.length; index += 1) {
|
|
1379
1404
|
const item = pending[index];
|
|
1405
|
+
const base = baseForItem(item);
|
|
1380
1406
|
taskList.progress(`分批生成并导入素材(${index + 1}/${pending.length}:${item.label})`);
|
|
1381
1407
|
item.status = 'running';
|
|
1382
1408
|
let stalled = 0;
|
|
@@ -1765,6 +1791,8 @@ export async function apply(ctx) {
|
|
|
1765
1791
|
validateScript: VALIDATE_SCRIPT,
|
|
1766
1792
|
styleBlock,
|
|
1767
1793
|
styleRules,
|
|
1794
|
+
kindBlock: '(prompt 子命令未指定本批 kind;实际运行时会按当前 kind 注入专属要求。)',
|
|
1795
|
+
genreBlock: renderGenreBlock(genres),
|
|
1768
1796
|
});
|
|
1769
1797
|
return notify(session, 'success', promptDisplayText(rendered));
|
|
1770
1798
|
} catch (err) {
|
|
@@ -468,3 +468,19 @@ export function customFocusBlock({ genre, materialType, kinds = [], allKinds = f
|
|
|
468
468
|
- genres 必须原样包含用户题材「${genre}」;可以再附加其它适用题材(1–5 个)。
|
|
469
469
|
- 其他质量、查询、追加规则继续适用。`;
|
|
470
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
|
+
}
|
|
@@ -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:
|
|
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),
|
|
@@ -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('
|
|
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,
|