@cloud411716/fancy-webnovel 4.30.35 → 4.30.37
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 +1 -1
- package/docs/material-library/manual/08-naming-method.md +172 -0
- package/docs/material-library/prompt.md +11 -88
- package/docs/material-library/schema.surql +1 -0
- package/lib/material-db.js +3 -3
- package/package.json +1 -1
- package/plugins/fancy-material/exporter.js +2 -1
- package/plugins/fancy-material/index.js +57 -2
- package/plugins/fancy-material/manual.js +3 -1
- package/plugins/fancy-material/scripts/query.js +3 -2
- package/plugins/fancy-material/styles.js +10 -1
- package/plugins/fancy-material/team.js +55 -32
- package/plugins/fancy-material/templates.js +14 -5
- package/plugins/fancy-material/validate.js +11 -3
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# 命名与描写方法论(55 kind)
|
|
2
|
+
|
|
3
|
+
## 0. 总纲
|
|
4
|
+
|
|
5
|
+
好素材名不是词华丽,而是四件事同时成立:
|
|
6
|
+
|
|
7
|
+
1. **错位反差**:属性冲突、体量冲突、时代冲突、身份冲突。
|
|
8
|
+
2. **留白缺口**:只给现象,不解释本质;读者会想问“这是什么”。
|
|
9
|
+
3. **因果痕迹**:名字里自带“发生过/将要发生”的过程,不是静态标签。
|
|
10
|
+
4. **感官锚定**:优先绑定视、听、触、嗅、动作,不用空评价词。
|
|
11
|
+
|
|
12
|
+
选词顺序:
|
|
13
|
+
|
|
14
|
+
**带过程感的状态词 > 具象感官名词 > 弱定性修饰词。**
|
|
15
|
+
|
|
16
|
+
优先找边界词、过渡词、残迹词、矛盾共存词;一条素材最多两组核心意象。
|
|
17
|
+
|
|
18
|
+
## 1. 通用规则
|
|
19
|
+
|
|
20
|
+
- 2–4 字为主,5–6 字只用于长名。
|
|
21
|
+
- 读一遍:声母不要连续同类,平仄不要全平,生僻字不要多。
|
|
22
|
+
- 不要用“的”把一句描述压成名字;事件、动作、后果写进 note/derivation。
|
|
23
|
+
- 不要事件过程、动作+时长、条件+结果、直白交易描述。
|
|
24
|
+
- 不要用“毁灭、最强、永恒、神圣、无敌、纯粹、全部”这类绝对化词。
|
|
25
|
+
- 示例只用于理解类别,不是词表;不要从示例里挑词。
|
|
26
|
+
|
|
27
|
+
## 2. 组级公式
|
|
28
|
+
|
|
29
|
+
### 命名组
|
|
30
|
+
|
|
31
|
+
- **状态 + 具象**:悬置/将尽/失联/冻结的状态 + 物件/空间。
|
|
32
|
+
- **对冲双意象**:柔/锐、生/朽、轻/重、明/幽、瞬/恒、微/宏。
|
|
33
|
+
- **空间 + 回响**:废弃/边界空间 + 留痕/回响动作。
|
|
34
|
+
- **微物 + 宏大**:微物 + 单向动作 + 宏大背景。
|
|
35
|
+
- **时间 + 终局**:时间标记 + 终局意象。
|
|
36
|
+
- **动作 + 对象**:强动词 + 物象。
|
|
37
|
+
- **身份/制度 + 边界**:身份/机构 + 凭证/边界。
|
|
38
|
+
- **数字/序列 + 物象**:编号/序数 + 物件/边界。
|
|
39
|
+
- **否定/缺失 + 物象**:无/未/缺/空/断 + 物象。
|
|
40
|
+
- **感官/媒介 + 信号**:声/光/影/像 + 频/码/帧/噪。
|
|
41
|
+
|
|
42
|
+
### 人物组
|
|
43
|
+
|
|
44
|
+
- 外貌:常规基底 + 一处反常痕迹。
|
|
45
|
+
- 气质:向外散发的氛围 + 反向微冲突。
|
|
46
|
+
- 性格:核心信念 + 无法控制的反向本能。
|
|
47
|
+
- 习惯:重复小动作 + 隐藏动机。
|
|
48
|
+
- 声音:音色基底 + 语言节奏特征。
|
|
49
|
+
- 出身:表层身份 + 被掩盖的本源身份。
|
|
50
|
+
|
|
51
|
+
### 关系与情绪组
|
|
52
|
+
|
|
53
|
+
- 反应:表层克制动作 + 泄露真实情绪的微小破绽。
|
|
54
|
+
- 情绪节拍:前置情绪 + 扰动事件 + 残留余韵。
|
|
55
|
+
- 关系动态:基础关系 + 一组互相牵制的反向诉求。
|
|
56
|
+
|
|
57
|
+
### 能力组
|
|
58
|
+
|
|
59
|
+
- 能力名:能力本源规则,不是效果;先用命名组公式。
|
|
60
|
+
- 特效:常规光影 + 一处违背常识的反常细节。
|
|
61
|
+
- 口号:宣告规则临时生效的短句,点明悖论。
|
|
62
|
+
- 机制:触发逻辑 + 它篡改/利用的世界底层规律。
|
|
63
|
+
- 发动条件:必须交付的东西或特定契机。
|
|
64
|
+
- 代价:获得力量,同步失去一种内在事物。
|
|
65
|
+
- 限制:强大范围 + 一条无法逾越的边界。
|
|
66
|
+
- 反制:针对底层机制的悖论解法。
|
|
67
|
+
- 力量来源:存在本源 + 交易/依附关系。
|
|
68
|
+
|
|
69
|
+
### 等级组
|
|
70
|
+
|
|
71
|
+
- 力量境界:存在状态词,层层递进,有主线。
|
|
72
|
+
- 势力职务:势力核心意象 + 职能动作。
|
|
73
|
+
|
|
74
|
+
### 物品组
|
|
75
|
+
|
|
76
|
+
- 外形:基础器物 + 一处反常畸变。
|
|
77
|
+
- 材质:两种矛盾质感复合。
|
|
78
|
+
- 功能:置换/记录/封存/引渡,不只杀伤。
|
|
79
|
+
- 视听:常态观感 + 反常视听细节。
|
|
80
|
+
|
|
81
|
+
### 场景与感官组
|
|
82
|
+
|
|
83
|
+
- 地点:基础环境 + 缓慢侵蚀/残留痕迹。
|
|
84
|
+
- 天气:常规天气 + 反常小现象。
|
|
85
|
+
- 视觉:正常景物 + 一处违背预期的异象。
|
|
86
|
+
- 听觉:安静基底 + 微弱异声/无源回响。
|
|
87
|
+
- 嗅觉:两种冲突气味叠加。
|
|
88
|
+
- 味觉:基础味道 + 后调反常余味。
|
|
89
|
+
|
|
90
|
+
### 描写词库组
|
|
91
|
+
|
|
92
|
+
- 颜色:主色 + 偏移状态(褪色、偏色、蒙尘)。
|
|
93
|
+
- 光影:光的运动状态,不只明暗。
|
|
94
|
+
- 声音:距离感、衰减感、失源感。
|
|
95
|
+
- 气味:残留、淡浸、若有若无。
|
|
96
|
+
- 触感:两种矛盾触感叠加。
|
|
97
|
+
- 特效:过程,不是结果。
|
|
98
|
+
- 速度/力量:速度和动静错位。
|
|
99
|
+
- 氛围:悬而未决的等待感。
|
|
100
|
+
- 容貌/体态:不协调、藏痕迹,不写完美。
|
|
101
|
+
- 表情/眼神:情绪藏在缝隙里。
|
|
102
|
+
- 动作动词:带势能、仪式感、克制感。
|
|
103
|
+
|
|
104
|
+
### 世界与势力组
|
|
105
|
+
|
|
106
|
+
- 世界规则:基础规律 + 必然带来的代价/漏洞。
|
|
107
|
+
- 势力文化:信条 + 必须承担的牺牲。
|
|
108
|
+
- 标志信物:核心意象 + 残缺/断裂形式。
|
|
109
|
+
- 仪式:行为流程 + 交付的代价。
|
|
110
|
+
|
|
111
|
+
### 剧情与脑洞组
|
|
112
|
+
|
|
113
|
+
- 脑洞:一条反直觉的因果置换。
|
|
114
|
+
- 伏笔:日常微小反常,后期成为因果节点。
|
|
115
|
+
|
|
116
|
+
## 3. 55 kind 对应
|
|
117
|
+
|
|
118
|
+
- `person_name`:命名组;找带时间/痕迹/冷感的字;避开绝对化、神魔化字。
|
|
119
|
+
- `nickname`:命名组;找“别人第一眼看到的标志性画面”;不要概括强弱。
|
|
120
|
+
- `place_name`:空间 + 回响 / 状态 + 具象;找边界、旧址、通道。
|
|
121
|
+
- `faction_name`:身份/制度 + 边界;找信条象征和归宿感;少用“殿、宗、盟”。
|
|
122
|
+
- `skill_name`:动作 + 对象 / 对冲;找方向感、仪式感。
|
|
123
|
+
- `item_name`:状态 + 器物 / 对冲;找记忆、封存、休眠感。
|
|
124
|
+
- `monster_name`:反常部位 + 基础生物;找畸变痕迹和违和感。
|
|
125
|
+
- `mythic_being`:权柄 + 存在状态 / 矛盾双意象;找本源、轮回、边界。
|
|
126
|
+
- `person_appearance`:常规基底 + 反常痕迹。
|
|
127
|
+
- `person_temperament`:氛围 + 反向微冲突。
|
|
128
|
+
- `person_personality`:信念 + 反向本能。
|
|
129
|
+
- `person_habit`:重复动作 + 隐藏动机。
|
|
130
|
+
- `person_voice`:音色 + 语言节奏。
|
|
131
|
+
- `person_background`:表层身份 + 本源身份。
|
|
132
|
+
- `reaction`:克制动作 + 微破绽。
|
|
133
|
+
- `emotion_beat`:前置情绪 + 扰动 + 余韵。
|
|
134
|
+
- `relationship_dynamic`:基础关系 + 反向诉求。
|
|
135
|
+
- `ability_name`:命名组;能力本源规则,不是效果。
|
|
136
|
+
- `ability_visual`:常规光影 + 反常细节。
|
|
137
|
+
- `ability_slogan`:宣告式短句 + 悖论。
|
|
138
|
+
- `ability_mechanism`:触发逻辑 + 底层规律篡改。
|
|
139
|
+
- `ability_activation`:交付物/契机。
|
|
140
|
+
- `ability_cost`:获得 + 失去的内在事物。
|
|
141
|
+
- `ability_limit`:强范围 + 诗意边界。
|
|
142
|
+
- `ability_counter`:规则对冲规则。
|
|
143
|
+
- `power_source`:存在本源 + 交易/依附。
|
|
144
|
+
- `power_rank`:存在状态递进。
|
|
145
|
+
- `faction_rank`:势力意象 + 职能动作。
|
|
146
|
+
- `item_form`:基础形态 + 畸变。
|
|
147
|
+
- `item_material`:矛盾质感复合。
|
|
148
|
+
- `item_function`:置换/记录/封存/引渡。
|
|
149
|
+
- `item_visual`:常态 + 反常视听。
|
|
150
|
+
- `location_feature`:环境 + 侵蚀/残留。
|
|
151
|
+
- `weather`:常规天气 + 反常小现象。
|
|
152
|
+
- `sensory_visual`:正常景物 + 违和异象。
|
|
153
|
+
- `sensory_sound`:安静 + 微弱异声。
|
|
154
|
+
- `sensory_smell`:冲突气味叠加。
|
|
155
|
+
- `sensory_taste`:基础味 + 反常后调。
|
|
156
|
+
- `color_word`:主色 + 偏移状态。
|
|
157
|
+
- `light_word`:光的运动状态。
|
|
158
|
+
- `sound_word`:距离/衰减/失源。
|
|
159
|
+
- `smell_word`:残留/淡浸。
|
|
160
|
+
- `touch_word`:矛盾触感。
|
|
161
|
+
- `effect_word`:过程而非结果。
|
|
162
|
+
- `speed_word`:速度与动静错位。
|
|
163
|
+
- `atmosphere_word`:悬而未决。
|
|
164
|
+
- `appearance_word`:不协调/藏痕迹。
|
|
165
|
+
- `expression_word`:情绪缝隙。
|
|
166
|
+
- `action_verb`:势能/仪式/克制。
|
|
167
|
+
- `world_rule`:规律 + 代价/漏洞。
|
|
168
|
+
- `faction_culture`:信条 + 牺牲。
|
|
169
|
+
- `faction_symbol`:意象 + 残缺形式。
|
|
170
|
+
- `ritual`:流程 + 交付代价。
|
|
171
|
+
- `brainstorm`:反直觉因果置换。
|
|
172
|
+
- `foreshadow`:日常微小反常。
|
|
@@ -199,89 +199,13 @@
|
|
|
199
199
|
- 名词性 kind:名字是名词性短语,能放进“我看见了___”或“这是___”;不要写成事件过程。
|
|
200
200
|
- 短句/描述 kind:可以是短句或画面,但要有具体画面和禁忌,不要写成操作说明。
|
|
201
201
|
|
|
202
|
-
##
|
|
202
|
+
## 五、命名与描写
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
按本批手册里的《命名与描写方法论》执行。名字先要好听、有画面、有张力、留白;note 再解释它。
|
|
205
205
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
不要先选后缀,再从词表拼名字。
|
|
211
|
-
|
|
212
|
-
### 5.0.1 具体异常(硬要求)
|
|
213
|
-
|
|
214
|
-
每条 note 要有一句能被读者复述的异常规则:它和日常功能哪里不一样、触发后发生什么、代价或限制是什么。
|
|
215
|
-
|
|
216
|
-
不要停在“有灵/有诅咒/有代价”,也不要只写“某机构 + 某代价”。
|
|
217
|
-
|
|
218
|
-
### 5.0.2 设定(硬要求)
|
|
219
|
-
|
|
220
|
-
每条 note 要写清这个设定本身:
|
|
221
|
-
|
|
222
|
-
1. 它是什么?
|
|
223
|
-
2. 它哪里不正常?
|
|
224
|
-
3. 代价或限制是什么?
|
|
225
|
-
4. 边界或漏洞在哪?
|
|
226
|
-
|
|
227
|
-
不要只写“物件 + 个人倒霉”。这个阶段只写设定,不展开谁使用、怎么使用。
|
|
228
|
-
|
|
229
|
-
### 5.1 命名形态(charging-bar 主风格专用,优先级最高)
|
|
230
|
-
|
|
231
|
-
名字不能是事件过程、动作+时长、条件+结果或直白交易描述。
|
|
232
|
-
|
|
233
|
-
判定:读 name,能不能直接改成“它会XXX”?能,就重写。
|
|
234
|
-
|
|
235
|
-
名字只保留设定成立后留下的痕迹、边界或债契;不要先选后缀,也不要从固定词表拼名字。
|
|
236
|
-
|
|
237
|
-
**先映射,再命名:**
|
|
238
|
-
|
|
239
|
-
1. 从当前世界设定取一条公理、代价、禁忌或组织流程。
|
|
240
|
-
2. 从十一个来源库里选 1–2 个母题、制度、物件或意象,与它建立映射。
|
|
241
|
-
3. 写清这个设定本身,再从 note 里已经发生的痕迹反推名字。
|
|
242
|
-
|
|
243
|
-
### 5.1.1 痕迹多样性(硬要求)
|
|
244
|
-
|
|
245
|
-
- 同一批 10 条:同一开头字最多 2 条;同一结尾痕迹字最多 2 条;同一双字后缀最多 2 条。
|
|
246
|
-
- 同一分系累计 20 条:同一开头字最多 4 条;同一结尾字最多 4 条;至少出现 8 种结尾;四字名最多 18 条;至少 2 条五字以上。
|
|
247
|
-
- 不得原样复用示例名;示例只用于理解形态。
|
|
248
|
-
- 如果本批触发了多样性硬校验,按失败信息重写,不要只换同义词。
|
|
249
|
-
|
|
250
|
-
### 5.1.2 痕迹落地(硬要求)
|
|
251
|
-
|
|
252
|
-
名字里的痕迹必须在 note 里能找到对应的物件、动作或后果。找不到就重写。
|
|
253
|
-
|
|
254
|
-
### 5.2 回望感测试
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
好名字不是第一眼就懂,而是:
|
|
259
|
-
|
|
260
|
-
```text
|
|
261
|
-
第一眼:有点怪 / 有点画面 / 有点没说完
|
|
262
|
-
第二眼:脑中浮出一个场景
|
|
263
|
-
看完 note:原来是这个意思
|
|
264
|
-
再回看名字:发现每个字都落在规则上
|
|
265
|
-
```
|
|
266
|
-
|
|
267
|
-
每个名字必须通过:
|
|
268
|
-
|
|
269
|
-
1. 遮住 note,只读名字:有没有画面、疑问或未完成感?
|
|
270
|
-
2. 遮住名字,只读 note:note 是否仍然具体成立?
|
|
271
|
-
3. 名字 + note:note 是不是只在字面解释名字?如果是,废。
|
|
272
|
-
4. 把名字换成通用名:note 是否仍然成立?如果是,名字没有做事,废。
|
|
273
|
-
5. 名字是否只靠空评价形容词或万能功能后缀?如果是,废。
|
|
274
|
-
6. 这条素材是不是只停在“规则必须遵守 / 违反会反噬”?如果是,废。
|
|
275
|
-
7. 它有没有一个“最坏的不是死,而是……”的瞬间?没有,废。
|
|
276
|
-
8. note 能不能让读者看懂这个设定怎么运作、什么时候会出问题?不能,重写。
|
|
277
|
-
9. 它是不是只是清单里的一个词条?如果是,给它一个“不对劲”的后果再写。
|
|
278
|
-
|
|
279
|
-
分层适用:
|
|
280
|
-
|
|
281
|
-
- `place_name`、`faction_name`、`skill_name`、`ability_name`、`item_name`、`monster_name`、`mythic_being`、`nickname`、`foreshadow`、`person_name`:优先要求回望感。
|
|
282
|
-
- `power_rank` / `faction_rank`:先保证层级清楚、可排序,再要求世界感;不要为了玄而牺牲可读性。
|
|
283
|
-
- `ability_mechanism` / `ability_activation` / `ability_cost` / `ability_limit` / `ability_counter` / `power_source`:回望感发生在六条组合后的闭环,不是每个字段都玩谜语。
|
|
284
|
-
- 人物描写、感官、词库:不要求“怔一下”,要求具体到能立刻看见画面。
|
|
206
|
+
- 名字不能只是日常物件 + 普通状态,也不能是事件过程或“修饰语 + 的 + 名词”的描述句。
|
|
207
|
+
- 事件、动作、后果写进 note/derivation,不写进名字。
|
|
208
|
+
- 同批不要反复用同一套结构、意象或命名形态;具体方法见手册。
|
|
285
209
|
|
|
286
210
|
## 六、本批素材的硬性要求
|
|
287
211
|
|
|
@@ -306,6 +230,7 @@ subkind / rank_order / note / source
|
|
|
306
230
|
- `subkind`:如果本批给出,必须逐条原样写入,最多 40 字。
|
|
307
231
|
- `rank_order`:等级阶梯必须从 1 开始连续递增,不断号、不重复。
|
|
308
232
|
- `note`:最多 300 字;写清这个设定是什么、哪里不正常、代价或限制、边界或漏洞;不展开故事,不写空泛解释。
|
|
233
|
+
- `derivation`:写清来源库(11 选 1–2)、映射链、为什么成立;可选检索词/参考;最多 400 字。所有 kind 必填。
|
|
309
234
|
- `source`:固定写 `{{SOURCE_FIXED}}`;{{SOURCE_NOTE}}
|
|
310
235
|
|
|
311
236
|
### 6.2 单 kind / 组模式
|
|
@@ -352,14 +277,12 @@ node '{{VALIDATE_SCRIPT}}' '<目标文件>'
|
|
|
352
277
|
|
|
353
278
|
逐条检查:
|
|
354
279
|
|
|
355
|
-
0.
|
|
356
|
-
0.1
|
|
357
|
-
0.2
|
|
358
|
-
0.1 **痕迹多样性**:本批 10 条是否用了超过 2 个相同结尾痕迹字?是否超过 2 个相同双字后缀?是否全是四字名、全是“器物 + 痕迹”?带“残/余”的名字是否超过 2 条?如果是,重写;残/余 最多 2 条。
|
|
359
|
-
0.2 **痕迹落地**:名字里的痕迹,能在 note 里指出具体物件或残留吗?如果 note 里根本没有这个痕迹,名字作废。
|
|
280
|
+
0. **名字测试**:遮住 note 只读名字,有没有画面、张力或一处不对劲?如果只是日常物件 + 普通状态,废;名字不能靠 note 补精彩。
|
|
281
|
+
0.1 **形态测试**:名字是不是事件过程、动作+时长、条件+结果、直白交易,或者“修饰语 + 的 + 名词”的描述句?如果是,重写。
|
|
282
|
+
0.2 **derivation 测试**:是否写明了来源库、映射链、为什么成立?如果只是复述 note,重写。
|
|
360
283
|
1. **回望测试**:遮住 note 只读名字,有画面/疑问吗?看完 note 再回看名字,能产生“原来是这个意思”吗?
|
|
361
284
|
2. **高概念测试**:它是不是只停在“规则必须遵守 / 违反会反噬”?如果是,重写。
|
|
362
|
-
3.
|
|
285
|
+
3. **场景测试**:它能不能让读者想到一个具体场景或后果?能不能看出什么时候会出问题?
|
|
363
286
|
4. 它能否在 30 秒内变成一个具体画面、动作、规则或人物关系?
|
|
364
287
|
5. 它是不是“火红、耀眼、神秘、强大”这类谁都能写的词?
|
|
365
288
|
6. 它有没有具体参照物、感官、情绪或处境?
|
|
@@ -368,7 +291,7 @@ node '{{VALIDATE_SCRIPT}}' '<目标文件>'
|
|
|
368
291
|
9. 名字是不是现实流程/业务词的裸写?如果是,要么加世界设定的异常边界/代价,要么重写。
|
|
369
292
|
10. `tags` 是否 3–8 个、覆盖多个维度、能用于检索?
|
|
370
293
|
11. `genres` 是否 1–10 个,并完整包含本次全部题材?
|
|
371
|
-
12.
|
|
294
|
+
12. 命名/措辞/体例是否匹配世界设定命名逻辑和 kind 硬规则?有没有跨题材串味?
|
|
372
295
|
13. 本批是单 kind 还是组模式?有没有混写其它 kind 或其它组?
|
|
373
296
|
14. 同一批(默认 10 条)是否至少 4 个不同物件/场所,而不是同一个关系模板换皮?小批次按比例减少。
|
|
374
297
|
15. `world_id` / `group_id` / `subkind` / `rank_order` 是否按本批要求逐条写入?
|
|
@@ -28,6 +28,7 @@ DEFINE FIELD OVERWRITE kind ON material TYPE string
|
|
|
28
28
|
DEFINE FIELD OVERWRITE name ON material TYPE string;
|
|
29
29
|
DEFINE FIELD OVERWRITE tags ON material TYPE array<string> DEFAULT [];
|
|
30
30
|
DEFINE FIELD OVERWRITE subject ON material TYPE option<string>;
|
|
31
|
+
DEFINE FIELD OVERWRITE derivation ON material TYPE option<string>;
|
|
31
32
|
DEFINE FIELD OVERWRITE genres ON material TYPE array<string> DEFAULT [];
|
|
32
33
|
DEFINE FIELD OVERWRITE tropes ON material TYPE option<array<string>>;
|
|
33
34
|
DEFINE FIELD OVERWRITE narrative ON material TYPE option<array<string>>;
|
package/lib/material-db.js
CHANGED
|
@@ -17,7 +17,7 @@ import { readSecrets, readWorkspace } from './workspace.js';
|
|
|
17
17
|
import { rpcUrl, startServer } from './surreal-server.js';
|
|
18
18
|
|
|
19
19
|
export const MATERIAL_DATABASE = 'material_library';
|
|
20
|
-
export const MATERIAL_SCHEMA_VERSION =
|
|
20
|
+
export const MATERIAL_SCHEMA_VERSION = 15;
|
|
21
21
|
|
|
22
22
|
const SCHEMA_FILE = fileURLToPath(new URL('../docs/material-library/schema.surql', import.meta.url));
|
|
23
23
|
|
|
@@ -61,7 +61,7 @@ export async function connectMaterial(root) {
|
|
|
61
61
|
/**
|
|
62
62
|
* Ensure the material database and its schema exist. Idempotent.
|
|
63
63
|
*
|
|
64
|
-
* Schema v14 changes the builtin kind catalog and adds material.world_id / rank_order; v13 adds the douyin_style table; v12 adds the douyin_account table; v11 adds the multi-layer material facets (`subject`, `tropes`, `narrative`, `traits`, `roles`, `relations`, `moods`, `settings`) and keeps the v10 douyin task tables / v9 subkind / v8 note assertion / v7 group_id / 58-kind catalog. Before applying the
|
|
64
|
+
* Schema v15 adds material.derivation; v14 changes the builtin kind catalog and adds material.world_id / rank_order; v13 adds the douyin_style table; v12 adds the douyin_account table; v11 adds the multi-layer material facets (`subject`, `tropes`, `narrative`, `traits`, `roles`, `relations`, `moods`, `settings`) and keeps the v10 douyin task tables / v9 subkind / v8 note assertion / v7 group_id / 58-kind catalog. Before applying the
|
|
65
65
|
* new ASSERT, rows belonging to retired kinds are removed; otherwise SurrealDB
|
|
66
66
|
* refuses to overwrite the field because existing records no longer conform.
|
|
67
67
|
*
|
|
@@ -102,7 +102,7 @@ export async function ensureMaterialDatabase(root) {
|
|
|
102
102
|
const tableInfo = await db.query('INFO FOR TABLE material;');
|
|
103
103
|
const table = Array.isArray(tableInfo) && tableInfo[0] ? tableInfo[0] : {};
|
|
104
104
|
if (!table.fields || !table.fields.source || !table.fields.kind || !table.fields.name || !table.fields.tags || !table.fields.group_id || !table.fields.subkind
|
|
105
|
-
|| !table.fields.subject || !table.fields.genres || !table.fields.tropes || !table.fields.narrative
|
|
105
|
+
|| !table.fields.subject || !table.fields.derivation || !table.fields.genres || !table.fields.tropes || !table.fields.narrative
|
|
106
106
|
|| !table.fields.traits || !table.fields.roles || !table.fields.relations || !table.fields.moods || !table.fields.settings || !table.fields.world_id || !table.fields.rank_order) {
|
|
107
107
|
throw new Error('素材库 schema 初始化后仍未找到 material 的多层标签字段(kind/name/tags/subject/genres/tropes/narrative/traits/roles/relations/moods/settings/world_id/rank_order)。');
|
|
108
108
|
}
|
package/package.json
CHANGED
|
@@ -51,6 +51,7 @@ const FACET_MARKDOWN_FIELDS = [
|
|
|
51
51
|
|
|
52
52
|
function pushFacetLines(lines, record) {
|
|
53
53
|
if (record.subject) lines.push('- **subject**:' + text(record.subject));
|
|
54
|
+
if (record.derivation) lines.push('- **derivation**:' + text(record.derivation));
|
|
54
55
|
for (const [field, label] of FACET_MARKDOWN_FIELDS) {
|
|
55
56
|
if (Array.isArray(record[field]) && record[field].length) {
|
|
56
57
|
lines.push('- **' + label + '**:' + valueText(record[field]));
|
|
@@ -165,7 +166,7 @@ export function renderMaterialMarkdown(records, meta = {}) {
|
|
|
165
166
|
export async function exportMaterials(root) {
|
|
166
167
|
const { db, database } = await connectMaterial(root);
|
|
167
168
|
try {
|
|
168
|
-
const rows = await db.query('SELECT kind, subkind, name, subject, tags, genres, tropes, narrative, traits, roles, relations, moods, settings, world_id, group_id, rank_order, note, source FROM material ORDER BY kind, subkind, rank_order, name;');
|
|
169
|
+
const rows = await db.query('SELECT kind, subkind, name, subject, derivation, tags, genres, tropes, narrative, traits, roles, relations, moods, settings, world_id, group_id, rank_order, note, source FROM material ORDER BY kind, subkind, rank_order, name;');
|
|
169
170
|
const records = Array.isArray(rows) && Array.isArray(rows[0]) ? rows[0] : [];
|
|
170
171
|
const file = path.join(path.resolve(root), '素材库.md');
|
|
171
172
|
const markdown = renderMaterialMarkdown(records, {
|
|
@@ -1650,6 +1650,41 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
1650
1650
|
return { ok: true, records };
|
|
1651
1651
|
};
|
|
1652
1652
|
|
|
1653
|
+
const filterTeamBatch = (file, item, groupId) => {
|
|
1654
|
+
const records = readJsonlRecords(file);
|
|
1655
|
+
const kept = [];
|
|
1656
|
+
const dropped = [];
|
|
1657
|
+
for (const record of records) {
|
|
1658
|
+
if (!record || typeof record !== 'object' || Array.isArray(record)) {
|
|
1659
|
+
dropped.push('非对象行');
|
|
1660
|
+
continue;
|
|
1661
|
+
}
|
|
1662
|
+
const reasons = [];
|
|
1663
|
+
if (item.kind && record.kind !== item.kind) reasons.push('kind');
|
|
1664
|
+
const recordGenres = Array.isArray(record.genres) ? record.genres : [];
|
|
1665
|
+
if (genres.some((genre) => !recordGenres.includes(genre))) reasons.push('genres');
|
|
1666
|
+
if (record.source !== 'builtin') reasons.push('source');
|
|
1667
|
+
if (worldId && record.world_id !== worldId) reasons.push('world_id');
|
|
1668
|
+
if (item.subkind && record.subkind !== item.subkind) reasons.push('subkind');
|
|
1669
|
+
const expectedGroup = item.group_id || groupId;
|
|
1670
|
+
if (expectedGroup && record.group_id !== expectedGroup) reasons.push('group_id');
|
|
1671
|
+
if (typeof record.name !== 'string' || !record.name.trim()) reasons.push('name');
|
|
1672
|
+
if (primaryStyleKey) {
|
|
1673
|
+
if (chargingBarNameFormProblem([record], primaryStyleKey)) reasons.push('name-form');
|
|
1674
|
+
if (chargingBarNameHighConceptProblem([record], primaryStyleKey)) reasons.push('name-concept');
|
|
1675
|
+
if (chargingBarNameGroundingProblem([record], primaryStyleKey)) reasons.push('name-grounding');
|
|
1676
|
+
}
|
|
1677
|
+
if (reasons.length) dropped.push((record.name || '未命名') + '(' + reasons.join('、') + ')');
|
|
1678
|
+
else kept.push(record);
|
|
1679
|
+
}
|
|
1680
|
+
if (!dropped.length) return { ok: true, kept: kept.length, dropped: 0, detail: '' };
|
|
1681
|
+
if (!kept.length) {
|
|
1682
|
+
return { ok: false, kept: 0, dropped: dropped.length, detail: dropped.slice(0, 20).join(';') };
|
|
1683
|
+
}
|
|
1684
|
+
fs.writeFileSync(file, kept.map((record) => JSON.stringify(record)).join('\n') + '\n', 'utf8');
|
|
1685
|
+
return { ok: true, kept: kept.length, dropped: dropped.length, detail: dropped.slice(0, 20).join(';') };
|
|
1686
|
+
};
|
|
1687
|
+
|
|
1653
1688
|
const acceptBatch = async (file, item, groupId) => {
|
|
1654
1689
|
const acceptedRecords = readJsonlRecords(file);
|
|
1655
1690
|
try {
|
|
@@ -1837,6 +1872,7 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
1837
1872
|
team,
|
|
1838
1873
|
signal: invocation.signal,
|
|
1839
1874
|
validate: (candidate) => validateBatch(candidate, item, groupId),
|
|
1875
|
+
filter: (candidate) => filterTeamBatch(candidate, item, groupId),
|
|
1840
1876
|
batchLabel: item.kind + (item.subkind ? '_' + item.subkind : ''),
|
|
1841
1877
|
batchId,
|
|
1842
1878
|
batchNo,
|
|
@@ -1903,9 +1939,16 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
1903
1939
|
}
|
|
1904
1940
|
}
|
|
1905
1941
|
|
|
1906
|
-
|
|
1942
|
+
let checked = await validateBatch(file, item, groupId);
|
|
1943
|
+
if (!checked.ok && useTeam) {
|
|
1944
|
+
const filtered = filterTeamBatch(file, item, groupId);
|
|
1945
|
+
if (filtered.dropped > 0) {
|
|
1946
|
+
attemptDetail = 'Team 过滤 ' + filtered.dropped + ' 条未过校验:' + filtered.detail;
|
|
1947
|
+
if (filtered.ok) checked = await validateBatch(file, item, groupId);
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1907
1950
|
if (!checked.ok) {
|
|
1908
|
-
attemptDetail = checked.detail;
|
|
1951
|
+
attemptDetail = checked.detail || attemptDetail;
|
|
1909
1952
|
continue;
|
|
1910
1953
|
}
|
|
1911
1954
|
const acceptedResult = await acceptBatch(file, item, groupId);
|
|
@@ -2002,6 +2045,13 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
2002
2045
|
kinds: selectedKinds,
|
|
2003
2046
|
imported: importedTotal,
|
|
2004
2047
|
batches: batchCount,
|
|
2048
|
+
kind_imports: queue.map((item) => ({
|
|
2049
|
+
kind: item.kind,
|
|
2050
|
+
subkind: item.subkind || '',
|
|
2051
|
+
label: item.label,
|
|
2052
|
+
imported: item.imported || 0,
|
|
2053
|
+
target: item.target,
|
|
2054
|
+
})),
|
|
2005
2055
|
};
|
|
2006
2056
|
flow.status = finalStatus === 'complete' ? 'generated' : (finalStatus === 'aborted' ? 'aborted' : 'incomplete');
|
|
2007
2057
|
flow.last_run = summary;
|
|
@@ -2022,6 +2072,11 @@ export async function runGenerationWithPlan(ctx, invocation, session, taskList,
|
|
|
2022
2072
|
incomplete,
|
|
2023
2073
|
notStarted,
|
|
2024
2074
|
importedTotal,
|
|
2075
|
+
kindImports: queue.map((item) => ({
|
|
2076
|
+
label: item.label,
|
|
2077
|
+
imported: item.imported || 0,
|
|
2078
|
+
target: item.target,
|
|
2079
|
+
})),
|
|
2025
2080
|
batches: batchCount,
|
|
2026
2081
|
total,
|
|
2027
2082
|
progressFile,
|
|
@@ -126,7 +126,8 @@ export function renderManualBlock({ kind = '', subkind = '', genres = [], seed =
|
|
|
126
126
|
const carrier = compact ? '' : readFile(path.join(MANUAL_DIR, '01-carrier.md'));
|
|
127
127
|
const naming = compact ? '' : readFile(path.join(MANUAL_DIR, '04-naming.md'));
|
|
128
128
|
const surprise = compact ? '' : readFile(path.join(MANUAL_DIR, '07-surprise.md'));
|
|
129
|
-
|
|
129
|
+
const method = readFile(path.join(MANUAL_DIR, '08-naming-method.md'));
|
|
130
|
+
if (!core && !carrier && !naming && !surprise && !method) return '';
|
|
130
131
|
|
|
131
132
|
const lines = [
|
|
132
133
|
'# 创作手册(本批必读)',
|
|
@@ -138,5 +139,6 @@ export function renderManualBlock({ kind = '', subkind = '', genres = [], seed =
|
|
|
138
139
|
if (carrier) lines.push(carrier, '');
|
|
139
140
|
if (naming) lines.push(naming, '');
|
|
140
141
|
if (surprise) lines.push(surprise, '');
|
|
142
|
+
if (method) lines.push(method, '');
|
|
141
143
|
return lines.join('\n').trim();
|
|
142
144
|
}
|
|
@@ -173,6 +173,7 @@ function rowText(row) {
|
|
|
173
173
|
const group = row.group_id ? ' | ' + row.group_id : '';
|
|
174
174
|
const sub = row.subkind ? ' | ' + row.subkind : '';
|
|
175
175
|
const subject = row.subject ? ' | subject=' + row.subject : '';
|
|
176
|
+
const derivation = row.derivation ? ' | derivation=' + row.derivation : '';
|
|
176
177
|
const facets = [
|
|
177
178
|
['tropes', 'tropes'],
|
|
178
179
|
['narrative', 'narrative'],
|
|
@@ -186,7 +187,7 @@ function rowText(row) {
|
|
|
186
187
|
.map(([field]) => field + '=' + row[field].join('、'))
|
|
187
188
|
.join(' | ');
|
|
188
189
|
return `[${row.kind}] ${row.name}${tags ? ' | ' + tags : ''}${genres ? ' | ' + genres : ''}`
|
|
189
|
-
+ `${subject}${facets ? ' | ' + facets : ''}${sub}${group}${source}`;
|
|
190
|
+
+ `${subject}${derivation}${facets ? ' | ' + facets : ''}${sub}${group}${source}`;
|
|
190
191
|
}
|
|
191
192
|
|
|
192
193
|
async function main() {
|
|
@@ -263,7 +264,7 @@ async function main() {
|
|
|
263
264
|
+ ')');
|
|
264
265
|
}
|
|
265
266
|
|
|
266
|
-
let sql = 'SELECT id, kind, subkind, name, subject, tags, genres, tropes, narrative, traits, roles, relations, moods, settings, group_id, source';
|
|
267
|
+
let sql = 'SELECT id, kind, subkind, name, subject, derivation, tags, genres, tropes, narrative, traits, roles, relations, moods, settings, group_id, source';
|
|
267
268
|
if (opts.search) sql += ', search::score(1) AS score';
|
|
268
269
|
sql += ' FROM material';
|
|
269
270
|
if (where.length) sql += ' WHERE ' + where.join(' AND ');
|
|
@@ -522,6 +522,13 @@ export function stylePromptBlock(styles, selected, { genres = [] } = {}) {
|
|
|
522
522
|
: style.style_type === 'structure'
|
|
523
523
|
? '结构参考(不参与命名)'
|
|
524
524
|
: '非命名参考(不参与命名)';
|
|
525
|
+
if (isNaming) {
|
|
526
|
+
lines.push(`#### \`${style.style_key}\`(${style.style_name})`);
|
|
527
|
+
lines.push('- 角色:' + role);
|
|
528
|
+
lines.push('- 语气参考:' + (String((style.naming_rules || {}).tone || style.dna || '').replace(/[。;;]+$/u, '')) + '(只影响语气;命名按手册方法)');
|
|
529
|
+
lines.push('');
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
525
532
|
lines.push(`#### \`${style.style_key}\`(${style.style_name})`);
|
|
526
533
|
lines.push('- 角色:' + role);
|
|
527
534
|
lines.push('- 风格类型:' + style.style_type);
|
|
@@ -611,10 +618,12 @@ export function styleBatchSummary(styles) {
|
|
|
611
618
|
? '辅助命名风格'
|
|
612
619
|
: '非命名参考';
|
|
613
620
|
const rules = style.naming_rules || {};
|
|
621
|
+
if (style.style_type === 'naming') {
|
|
622
|
+
return `- [${role}] ${style.style_key}(${style.style_name}):语气 ${String(rules.tone || '').replace(/[。;;]+$/u, '') || '按世界设定'}(只影响语气,命名按手册方法)`;
|
|
623
|
+
}
|
|
614
624
|
const bits = [
|
|
615
625
|
`- [${role}] ${style.style_key}(${style.style_name}):${String(style.dna || '').replace(/[。;;]+$/u, '')}`,
|
|
616
626
|
];
|
|
617
|
-
if (style.style_type === 'naming') bits.push('命名模式 `' + (style.naming_mode || 'image') + '`');
|
|
618
627
|
if (rules.length) bits.push(`长度 ${Array.isArray(rules.length) ? rules.length.join('–') + ' 字' : rules.length}`);
|
|
619
628
|
return bits.join(';');
|
|
620
629
|
}).join('\n');
|
|
@@ -224,14 +224,11 @@ const TEAM_RUBRIC = `
|
|
|
224
224
|
PASS 仅当没有 blocker/major。minor 可以记录但不阻塞。
|
|
225
225
|
|
|
226
226
|
每条素材检查:
|
|
227
|
-
1.
|
|
228
|
-
2.
|
|
229
|
-
3.
|
|
230
|
-
4.
|
|
231
|
-
5.
|
|
232
|
-
6. 把舞台换掉,名字还成立吗?成立则说明名字没有咬住规则。
|
|
233
|
-
7. 同批是否有明显重复的物件/关系模板/命名形态?
|
|
234
|
-
8. 同批 note 是否大量复用同一结构/同一句式?超过一半要求重写。
|
|
227
|
+
1. derivation 是否写明来源库(11 选 1–2)、映射链、为什么成立?缺失或只是复述 note → blocker。
|
|
228
|
+
2. 名字是否好听、有画面、有张力、留白?是不是事件过程、动作+时长、条件+结果、直白交易或“修饰语 + 的 + 名词”的描述句? → major/blocker。
|
|
229
|
+
3. 设定是否写清是什么、哪里反常、代价或限制、边界或漏洞?
|
|
230
|
+
4. 同批是否大量复用同一结构、同一意象或同一命名形态?
|
|
231
|
+
5. 是否直接复用旧库的名字/设定,而不是只借结构?
|
|
235
232
|
|
|
236
233
|
返回 JSON:
|
|
237
234
|
{ "verdict": "PASS" | "CHANGES", "issues": [{ "severity": "blocker|major|minor", "why": "...", "fix": "..." }] }
|
|
@@ -475,7 +472,7 @@ const judgePrompt = (round, aPassed, bPassed, history, fileA, fileB, finalFile,
|
|
|
475
472
|
'你是主编。读取 ' + rubricFile + '、' + fileA + '、' + fileB + '。' +
|
|
476
473
|
'第 ' + round + ' 轮结束:A=' + (aPassed ? 'PASS' : 'OPEN') + ',B=' + (bPassed ? 'PASS' : 'OPEN') + '。' +
|
|
477
474
|
'交叉审查记录:\n' + JSON.stringify(history).slice(0, 16000) + '\n' +
|
|
478
|
-
'
|
|
475
|
+
'优先选 derivation 更扎实、名字更符合方法论的一方;必须选择 PICK_A / PICK_B / MERGE / REJECT,不能和稀泥。' +
|
|
479
476
|
'如果选择 PICK_A、PICK_B 或 MERGE,把最终 JSONL 写到 ' + finalFile + '。' +
|
|
480
477
|
'返回 {"decision":"...","rationale":"..."}。';
|
|
481
478
|
|
|
@@ -502,6 +499,7 @@ export async function runTeamBatch({
|
|
|
502
499
|
team,
|
|
503
500
|
signal,
|
|
504
501
|
validate,
|
|
502
|
+
filter,
|
|
505
503
|
batchLabel = 'batch',
|
|
506
504
|
batchId = '',
|
|
507
505
|
batchNo = 1,
|
|
@@ -714,41 +712,66 @@ export async function runTeamBatch({
|
|
|
714
712
|
return { ok: false, error: 'team workflow 完成,但' + meta.error + '。' };
|
|
715
713
|
}
|
|
716
714
|
|
|
715
|
+
let partial = false;
|
|
716
|
+
let kept = 0;
|
|
717
|
+
let dropped = 0;
|
|
717
718
|
if (typeof validate === 'function') {
|
|
718
719
|
let checked = await validate(candidate);
|
|
719
720
|
if (!checked.ok) {
|
|
720
721
|
meta.validationError = checked.detail;
|
|
721
722
|
writeJsonFile(metaFile, meta);
|
|
722
|
-
if (calls
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
723
|
+
if (calls < maxCalls) {
|
|
724
|
+
const repaired = await call(
|
|
725
|
+
repairPrompt(candidate, checked.detail, finalFile),
|
|
726
|
+
team.judge,
|
|
727
|
+
'repair',
|
|
728
|
+
JUDGE_SCHEMA,
|
|
729
|
+
);
|
|
730
|
+
if (repaired.ok && fs.existsSync(finalFile)) {
|
|
731
|
+
meta.repair = repaired.value;
|
|
732
|
+
const rechecked = await validate(finalFile);
|
|
733
|
+
if (rechecked.ok) {
|
|
734
|
+
candidate = finalFile;
|
|
735
|
+
fallback = false;
|
|
736
|
+
checked = rechecked;
|
|
737
|
+
} else {
|
|
738
|
+
meta.repairValidationError = rechecked.detail;
|
|
739
|
+
}
|
|
740
|
+
} else {
|
|
741
|
+
meta.repairError = repaired.ok ? '裁判修复后没有写出 final.jsonl' : ('裁判修复失败:' + repaired.error);
|
|
742
|
+
}
|
|
735
743
|
writeJsonFile(metaFile, meta);
|
|
736
|
-
return { ok: false, error: meta.error };
|
|
737
744
|
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
745
|
+
|
|
746
|
+
// The judge may have produced a mixed batch. Keep the rows that pass the
|
|
747
|
+
// hard checks, import them, and let the outer loop generate the rest.
|
|
748
|
+
if (!checked.ok && typeof filter === 'function') {
|
|
749
|
+
const filtered = await filter(candidate);
|
|
750
|
+
meta.filter = filtered;
|
|
751
|
+
if (filtered && filtered.ok) {
|
|
752
|
+
const rechecked = await validate(candidate);
|
|
753
|
+
if (rechecked.ok) {
|
|
754
|
+
checked = rechecked;
|
|
755
|
+
partial = true;
|
|
756
|
+
kept = filtered.kept;
|
|
757
|
+
dropped = filtered.dropped;
|
|
758
|
+
meta.partial = true;
|
|
759
|
+
meta.kept = kept;
|
|
760
|
+
meta.dropped = dropped;
|
|
761
|
+
meta.filterDetail = filtered.detail;
|
|
762
|
+
} else {
|
|
763
|
+
meta.filterValidationError = rechecked.detail;
|
|
764
|
+
}
|
|
765
|
+
}
|
|
741
766
|
writeJsonFile(metaFile, meta);
|
|
742
|
-
return { ok: false, error: meta.error };
|
|
743
767
|
}
|
|
744
|
-
|
|
768
|
+
|
|
745
769
|
if (!checked.ok) {
|
|
746
|
-
meta.error = '裁判修复后仍未通过校验:'
|
|
770
|
+
meta.error = '裁判修复后仍未通过校验:'
|
|
771
|
+
+ (checked.detail || meta.repairValidationError || meta.filterValidationError || meta.validationError || '未知错误');
|
|
747
772
|
writeJsonFile(metaFile, meta);
|
|
748
773
|
return { ok: false, error: meta.error };
|
|
749
774
|
}
|
|
750
|
-
candidate = finalFile;
|
|
751
|
-
fallback = false;
|
|
752
775
|
}
|
|
753
776
|
}
|
|
754
777
|
|
|
@@ -759,7 +782,7 @@ export async function runTeamBatch({
|
|
|
759
782
|
writeJsonFile(metaFile, meta);
|
|
760
783
|
return {
|
|
761
784
|
ok: true,
|
|
762
|
-
result: { round, aPassed, bPassed, calls, judge: judge.value },
|
|
785
|
+
result: { round, aPassed, bPassed, calls, judge: judge.value, partial, kept, dropped },
|
|
763
786
|
finalFile: candidate,
|
|
764
787
|
fallback,
|
|
765
788
|
};
|
|
@@ -42,7 +42,7 @@ export function helpText() {
|
|
|
42
42
|
/fancy-material help 显示本帮助
|
|
43
43
|
|
|
44
44
|
说明:
|
|
45
|
-
- 素材是原子积木,每条有 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / source;世界/组/等级序号可选。
|
|
45
|
+
- 素材是原子积木,每条有 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / derivation / source;世界/组/等级序号可选。
|
|
46
46
|
- 素材库还支持 subject / tropes / narrative / traits / roles / relations / moods / settings 等多层 facet;它们主要由 fancy-douyin 分析结果填充,fancy-material 生成时可省略。
|
|
47
47
|
- subkind 是 kind 下的二级分类(例如 kind=特殊体质,subkind=病理变异);用于同一 kind 内再分组。
|
|
48
48
|
- note 可选,最多 300 字;都市类地名/势力/能力名优先写内层身份,表层伪装名写 note。
|
|
@@ -104,7 +104,7 @@ function compactRules(genres, queryScript, workspace, sourceFixed = 'builtin') {
|
|
|
104
104
|
'- 名字是设定留下的痕迹/边界,不是流程说明书;现实流程词只能做底层逻辑。',
|
|
105
105
|
'- 名词性 kind 的名字必须能放进“我看见了___”;动作+时长、条件+结果、状态+动作不算名字。',
|
|
106
106
|
'- charging-bar 主风格:名字只能是痕迹/印记/边界/债契;事件、时长、效果全部进 note。',
|
|
107
|
-
'- 字段只能是 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / source;'
|
|
107
|
+
'- 字段只能是 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / derivation / source;'
|
|
108
108
|
+ 'source 写 ' + sourceFixed + ';tags 3–8 个,genres 1–10 个。',
|
|
109
109
|
'- tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去;'
|
|
110
110
|
+ '例如「都市高武」可以写 tags: ["都市","高武","都市高武", ...]。',
|
|
@@ -242,7 +242,7 @@ export function generationPrompt({
|
|
|
242
242
|
|
|
243
243
|
lines.push('');
|
|
244
244
|
lines.push('写入要求:');
|
|
245
|
-
lines.push('1. 只把 JSONL 写进目标文件,一行一个对象;字段只能是 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / source,source 固定写 ' + sourceFixed + '。tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去(例如 都市高武 → 都市、高武、都市高武)。');
|
|
245
|
+
lines.push('1. 只把 JSONL 写进目标文件,一行一个对象;字段只能是 id / kind / name / tags / genres / world_id / group_id / subkind / rank_order / note / derivation / source,source 固定写 ' + sourceFixed + '。tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去(例如 都市高武 → 都市、高武、都市高武)。');
|
|
246
246
|
lines.push('2. 命名/措辞/体例必须匹配题材文化体系,禁止跨题材串用后缀;都市类地名/势力/能力名优先写内层身份,表层日常伪装名写 note(最多 300 字)。');
|
|
247
247
|
lines.push('2.1 本次 facet 是交集:同一层多选全部同时成立;素材必须同时满足所有选中层,不能只取一部分。选中的 tropes / moods / settings / roles / relations 要原样写进对应数组。');
|
|
248
248
|
lines.push('3. tags 不能用质量评价词:精品、高价值、文笔好、强力、神秘。');
|
|
@@ -305,7 +305,8 @@ function groupTail({ attempt, failures, target, validateScript, queryScript, exi
|
|
|
305
305
|
lines.push('4. tags 不能用质量评价词:精品、高价值、文笔好、强力、神秘。');
|
|
306
306
|
lines.push('5. 写完后运行 validate.js;失败就按错误修正,直到通过。');
|
|
307
307
|
lines.push('6. 不要自己运行导入命令;插件会负责校验和追加导入。');
|
|
308
|
-
lines.push('7.
|
|
308
|
+
lines.push('7. 每条必须写 derivation:来源库、映射链、为什么成立;不得超过 400 字。');
|
|
309
|
+
lines.push('8. 写完后只回复:已写入 <目标文件路径>;然后结束本轮。');
|
|
309
310
|
if (attempt > 1) {
|
|
310
311
|
lines.push('', '## 上次文件没有通过校验', '');
|
|
311
312
|
const list = Array.isArray(failures) ? failures : [failures];
|
|
@@ -455,6 +456,7 @@ export function generationRunText({
|
|
|
455
456
|
incomplete = [],
|
|
456
457
|
notStarted = [],
|
|
457
458
|
importedTotal = 0,
|
|
459
|
+
kindImports = [],
|
|
458
460
|
batches = 0,
|
|
459
461
|
total,
|
|
460
462
|
progressFile,
|
|
@@ -478,13 +480,20 @@ export function generationRunText({
|
|
|
478
480
|
if (incomplete.length) {
|
|
479
481
|
lines.push('未完成:' + incomplete.length + ' 个 kind');
|
|
480
482
|
for (const item of incomplete.slice(0, 20)) {
|
|
481
|
-
lines.push(' - ' + (item.label || item.kind || '自定义素材') + '
|
|
483
|
+
lines.push(' - ' + (item.label || item.kind || '自定义素材') + ':最终插入 ' + (item.imported || 0) + ' 条(目标 ' + targetPerKind + ')'
|
|
482
484
|
+ (item.reason ? '(' + item.reason + ')' : ''));
|
|
483
485
|
}
|
|
484
486
|
if (incomplete.length > 20) lines.push(' - 其余 ' + (incomplete.length - 20) + ' 个省略');
|
|
485
487
|
}
|
|
486
488
|
if (!batches && !incomplete.length && !notStarted.length && !stopReason) lines.push('本次没有生成任何素材。');
|
|
487
489
|
lines.push('本次新增:' + importedTotal + ' 条');
|
|
490
|
+
if (Array.isArray(kindImports) && kindImports.length) {
|
|
491
|
+
lines.push('各 kind 最终插入:');
|
|
492
|
+
for (const entry of kindImports) {
|
|
493
|
+
lines.push(' - ' + entry.label + ':' + (entry.imported || 0) + ' 条'
|
|
494
|
+
+ (Number.isFinite(entry.target) ? '(目标 ' + entry.target + ')' : ''));
|
|
495
|
+
}
|
|
496
|
+
}
|
|
488
497
|
if (Number.isFinite(total)) lines.push('库中素材:' + total + ' 条');
|
|
489
498
|
if (batches) lines.push('已导入批次:' + batches + ' 批');
|
|
490
499
|
if (worldTitle) lines.push('本次世界设定:' + worldTitle);
|
|
@@ -13,11 +13,12 @@ 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', 'world_id', 'rank_order', 'note', 'source',
|
|
16
|
+
'id', 'kind', 'name', 'subject', 'derivation', 'tags', 'group_id', 'subkind', 'world_id', 'rank_order', 'note', 'source',
|
|
17
17
|
...MATERIAL_FACET_FIELDS,
|
|
18
18
|
]);
|
|
19
19
|
const QUALITY_TAGS = new Set(['精品', '高价值', '文笔好', '强力', '神秘']);
|
|
20
20
|
const NOTE_MAX = 300;
|
|
21
|
+
const DERIVATION_MAX = 400;
|
|
21
22
|
const SUBKIND_MAX = 40;
|
|
22
23
|
const ID_RE = /^[a-z][a-z0-9_]*$/;
|
|
23
24
|
|
|
@@ -29,12 +30,12 @@ function usage() {
|
|
|
29
30
|
|
|
30
31
|
检查:
|
|
31
32
|
- 一行一个合法 JSON 对象
|
|
32
|
-
- 字段只能是 id / kind / name / subject / tags / genres / tropes / narrative / traits / roles / relations / moods / settings / world_id / group_id / subkind / rank_order / note / source
|
|
33
|
+
- 字段只能是 id / kind / name / subject / derivation / tags / genres / tropes / narrative / traits / roles / relations / moods / settings / world_id / group_id / subkind / rank_order / note / source
|
|
33
34
|
- source 只能是 builtin / other
|
|
34
35
|
- builtin 的 kind 必须在允许列表内,id 以 kind 开头
|
|
35
36
|
- other 的 kind 不受限制
|
|
36
37
|
- tags 3–12 个;genres 1–10 个;其它 facet 可选,0–10 个
|
|
37
|
-
- subject 可选,最多 120 字;subkind 可选,最多 40 字;note 最多 300 字
|
|
38
|
+
- subject 可选,最多 120 字;derivation 可选,最多 400 字;subkind 可选,最多 40 字;note 最多 300 字
|
|
38
39
|
- 同文件内 kind + name 不重复
|
|
39
40
|
|
|
40
41
|
退出码:0=通过,1=有错误,2=用法错误`;
|
|
@@ -91,6 +92,13 @@ function validate(raw, line) {
|
|
|
91
92
|
errors.push('第 ' + line + ' 行:subject 不能超过 ' + MATERIAL_SUBJECT_MAX + ' 字');
|
|
92
93
|
}
|
|
93
94
|
}
|
|
95
|
+
if (raw.derivation !== undefined) {
|
|
96
|
+
if (typeof raw.derivation !== 'string') {
|
|
97
|
+
errors.push('第 ' + line + ' 行:derivation 必须是字符串');
|
|
98
|
+
} else if (raw.derivation.trim().length > DERIVATION_MAX) {
|
|
99
|
+
errors.push('第 ' + line + ' 行:derivation 不能超过 ' + DERIVATION_MAX + ' 字');
|
|
100
|
+
}
|
|
101
|
+
}
|
|
94
102
|
if (raw.group_id !== undefined) {
|
|
95
103
|
if (typeof raw.group_id !== 'string' || !raw.group_id.trim()) {
|
|
96
104
|
errors.push('第 ' + line + ' 行:group_id 必须是非空字符串');
|