@cloud411716/fancy-webnovel 4.27.3 → 4.29.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 +9 -1
- package/docs/material-library/README.md +53 -53
- package/docs/material-library/prompt.md +12 -6
- package/docs/material-library/schema.surql +40 -1
- package/docs/workspace-mcp.md +4 -3
- package/lib/material-db.js +9 -2
- package/package.json +1 -1
- package/plugins/fancy-bootstrap/index.js +1 -1
- package/plugins/fancy-db/index.js +1 -1
- package/plugins/fancy-douyin/index.js +80 -1
- package/plugins/fancy-douyin/state.js +24 -1
- package/plugins/fancy-douyin/style-distill.js +197 -0
- package/plugins/fancy-douyin/templates.js +8 -1
- package/plugins/fancy-material/builtin-styles.js +448 -0
- package/plugins/fancy-material/index.js +741 -190
- package/plugins/fancy-material/inventory.js +10 -8
- package/plugins/fancy-material/prompts/world-mother.md +81 -0
- package/plugins/fancy-material/styles.js +441 -0
- package/plugins/fancy-material/templates.js +56 -22
- package/plugins/fancy-material/world.js +602 -0
- package/plugins/fancy-topic/index.js +39 -18
- package/plugins/fancy-topic/prompts/02-setup-prompt.md +44 -25
- package/plugins/fancy-topic/scripts/save-minimal-topic.js +1 -1
- package/plugins/fancy-topic/templates.js +33 -19
|
@@ -21,10 +21,11 @@ export function helpText() {
|
|
|
21
21
|
}).join('\n');
|
|
22
22
|
return `🧩 素材库 用法
|
|
23
23
|
|
|
24
|
-
/fancy-material
|
|
25
|
-
/fancy-material
|
|
26
|
-
/fancy-material
|
|
27
|
-
/fancy-material
|
|
24
|
+
/fancy-material 交互式:逐步选择 6 层 facet → 3 个世界母体候选 → 生成范围/数量 → 生成素材
|
|
25
|
+
/fancy-material continue 沿用上次的世界母体、facet、风格和范围,继续追加素材
|
|
26
|
+
/fancy-material --fresh 重新构建世界母体(旧素材保留,不删除)
|
|
27
|
+
/fancy-material --style <key> ... 手动指定账号风格;多个用逗号分隔,例如 --style suci,crazy-fish
|
|
28
|
+
不指定时在交互流程里选择:自动 / 不使用 / 具体 key
|
|
28
29
|
/fancy-material load <文件.jsonl> 导入 JSONL;导入前先校验格式
|
|
29
30
|
/fancy-material init 创建/补齐素材库 schema、索引和查询/校验脚本
|
|
30
31
|
/fancy-material remove 删除整个素材库(会二次确认)
|
|
@@ -41,15 +42,18 @@ export function helpText() {
|
|
|
41
42
|
- note 可选,最多 300 字;都市类地名/势力/能力名优先写内层身份,表层伪装名写 note。
|
|
42
43
|
- 命名/措辞按题材文化体系适配:东方仙侠用诀/式/法/印,都市高武用令/条/章/程,西幻用契/印/律/颂,科幻用协议/阈值/序列,历史用司/署/营/旗,悬疑用规则/现象/编号,言情以意象词为主。
|
|
43
44
|
- 禁止用质量评价词做 tags:精品、高价值、文笔好、强力、神秘。
|
|
44
|
-
- tags 和 genres 都是数组:tags 3–8 个,genres 1–
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
45
|
+
- tags 和 genres 都是数组:tags 3–8 个,genres 1–10 个;一个素材可以同时适配多个题材/标签。
|
|
46
|
+
- 每次运行默认每个 kind 新增 20 条;每批最多 10 条,插件自动分批直到完成。
|
|
47
|
+
- facet 多选是**交集**:同一层选中的每一项都必须同时满足,不是任选其一。例如题材选 都市+异能+脑洞,素材必须同时满足三种。
|
|
48
|
+
- 复合题材(都市异能、悬疑脑洞等)会展开成原子题材;展开后的每一项都必须满足。
|
|
49
|
+
- 题材/方向/定位来自 _novel_topic_suggestion.json 时只做推荐值;用户本次选择优先,fancy-material 不修改该文件。
|
|
50
|
+
- 世界母体保存在 <工作区>/.fancy/material/flow.json;continue 会沿用它,不删除旧素材。
|
|
51
|
+
- 风格来源:内置风格库 + 数据库 douyin_style;交互流程里可选自动、不使用或具体 key,也可用 --style 预填。
|
|
52
|
+
- 用 /fancy-douyin list 查看账号的 style_key、风格名和示例。
|
|
53
|
+
- 不设库内上限:运行两次就是每个 kind 累计追加;已有素材只用于去重。
|
|
54
|
+
- 中断后继续用 /fancy-material continue 沿用同一世界;已经导入的素材不会撤销。
|
|
52
55
|
- 只追加,不覆盖;同 kind 同 name 的素材会被跳过。
|
|
56
|
+
- 旧的 /fancy-material <素材类型>、<题材> <素材类型>、<题材> all 已移除。
|
|
53
57
|
- dump / load 面向 Markdown 清单和 JSONL 素材;export / import 面向 SurrealDB 原生 SurrealQL 备份。
|
|
54
58
|
- 原生 import 会补齐 schema,并追加备份中尚不存在的记录;相同记录 ID 已存在时自动跳过,不会覆盖。
|
|
55
59
|
- 全文索引:name(中文 ngram);tags / genres 精确过滤。
|
|
@@ -63,7 +67,7 @@ ${genreBlock}
|
|
|
63
67
|
${kindBlock}`;
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
export const DEFAULT_TARGET_PER_KIND =
|
|
70
|
+
export const DEFAULT_TARGET_PER_KIND = 20;
|
|
67
71
|
export const DEFAULT_BATCH_SIZE = 10;
|
|
68
72
|
|
|
69
73
|
/**
|
|
@@ -89,15 +93,16 @@ function compactRules(genres, queryScript, workspace, sourceFixed = 'builtin') {
|
|
|
89
93
|
'- 每条必须独立、具体、可复用;拒绝“火红、耀眼、神秘、强大”这类空泛词。',
|
|
90
94
|
'- 命名类必须有具体锚点;拒绝“复原眼、章眼、旧仓单、神秘剑、黑色长刀”这类废名。',
|
|
91
95
|
'- 字段只能是 id / kind / name / tags / genres / group_id / subkind / note / source;'
|
|
92
|
-
+ 'source 写 ' + sourceFixed + ';tags 3–8 个,genres 1–
|
|
96
|
+
+ 'source 写 ' + sourceFixed + ';tags 3–8 个,genres 1–10 个。',
|
|
93
97
|
'- tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去;'
|
|
94
98
|
+ '例如「都市高武」可以写 tags: ["都市","高武","都市高武", ...]。',
|
|
95
99
|
'- 命名/措辞/体例必须匹配题材文化体系,禁止跨题材串用后缀。',
|
|
100
|
+
'- facet 多选是交集:同一层选中的每一项都必须同时成立,不能只取其中一个;能写进对应 facet 数组的,要原样写全。',
|
|
96
101
|
'- 都市类地名/势力/能力名优先写内层身份,表层日常伪装名写 note;note 最多 300 字。',
|
|
97
102
|
'- tags 不能用质量评价词:精品、高价值、文笔好、强力、神秘。',
|
|
98
103
|
];
|
|
99
104
|
if (Array.isArray(genres) && genres.length) {
|
|
100
|
-
lines.push('- genres
|
|
105
|
+
lines.push('- genres 必须原样包含本次全部题材:' + genres.join('、') + ';缺任何一个都算废稿。');
|
|
101
106
|
}
|
|
102
107
|
if (queryScript) {
|
|
103
108
|
lines.push('- 生成前查询已有素材:`node \'' + queryScript + '\' --workspace \'' + workspace
|
|
@@ -134,6 +139,9 @@ export function generationPrompt({
|
|
|
134
139
|
custom = null,
|
|
135
140
|
customKindPending = false,
|
|
136
141
|
sourceFixed = 'builtin',
|
|
142
|
+
styleSummary = '',
|
|
143
|
+
worldBlock = '',
|
|
144
|
+
worldSummary = '',
|
|
137
145
|
}) {
|
|
138
146
|
const lines = [];
|
|
139
147
|
if (includeBase && base) {
|
|
@@ -142,8 +150,12 @@ export function generationPrompt({
|
|
|
142
150
|
lines.push('## 继续生成(同一素材库)', '');
|
|
143
151
|
lines.push('继续遵守最初提示词中的角色、写作原则、质量红线、命名标准、描写标准、查询与追加规则。不要重新解释规则,直接写本批素材。', '');
|
|
144
152
|
lines.push(...compactRules(genres, queryScript, workspace, sourceFixed), '');
|
|
153
|
+
if (worldSummary) lines.push('## 本批世界母体锁定(必须保持)', '', worldSummary, '');
|
|
145
154
|
}
|
|
146
155
|
|
|
156
|
+
if (styleSummary) {
|
|
157
|
+
lines.push('## 本批风格锁定(必须保持)', '', styleSummary, '');
|
|
158
|
+
}
|
|
147
159
|
lines.push('## 本次运行', '');
|
|
148
160
|
lines.push('- 工作区目录:' + workspace);
|
|
149
161
|
lines.push('- 目标文件(**绝对路径**):`' + target + '`');
|
|
@@ -152,13 +164,24 @@ export function generationPrompt({
|
|
|
152
164
|
? 'topic(_novel_topic.json)'
|
|
153
165
|
: mode === 'suggestion'
|
|
154
166
|
? 'suggestion(_novel_topic_suggestion.json)'
|
|
155
|
-
: mode === '
|
|
156
|
-
? '
|
|
157
|
-
: mode === '
|
|
158
|
-
? '
|
|
159
|
-
:
|
|
167
|
+
: mode === 'world'
|
|
168
|
+
? 'world(世界母体 + facet 交集)'
|
|
169
|
+
: mode === 'builtin'
|
|
170
|
+
? 'builtin(内置全题材)'
|
|
171
|
+
: mode === 'other'
|
|
172
|
+
? 'other(用户自定义题材 + 素材类型)'
|
|
173
|
+
: String(mode || '未指定');
|
|
160
174
|
lines.push('- 题材模式:' + modeLabel);
|
|
161
|
-
if (
|
|
175
|
+
if (worldBlock && includeBase) {
|
|
176
|
+
// 世界母体已经包含在 base 里;这里只提醒本批仍受它约束。
|
|
177
|
+
lines.push('- 世界母体:见上方「世界母体(最高优先级)」;本批所有素材都必须从该母体推导。');
|
|
178
|
+
}
|
|
179
|
+
if (Array.isArray(genres) && genres.length) {
|
|
180
|
+
lines.push('- 本次题材(全部同时满足):' + genres.join('、'));
|
|
181
|
+
lines.push('- 题材交集规则:以上每一项都必须出现在素材的 genres 里;不是任选其一。');
|
|
182
|
+
} else {
|
|
183
|
+
lines.push('- 本次题材:无限制;按世界母体推导,但每条素材仍要写 1–10 个 genres。');
|
|
184
|
+
}
|
|
162
185
|
if (custom) {
|
|
163
186
|
lines.push('- 用户素材类型:' + (custom.allKinds ? 'all(全部 ' + MATERIAL_KINDS.length + ' 个素材类型)' : custom.materialType));
|
|
164
187
|
lines.push('- 素材来源:**other**(用户自定义素材,不是内置目录)');
|
|
@@ -199,6 +222,7 @@ export function generationPrompt({
|
|
|
199
222
|
lines.push('写入要求:');
|
|
200
223
|
lines.push('1. 只把 JSONL 写进目标文件,一行一个对象;字段只能是 id / kind / name / tags / genres / group_id / subkind / note / source,source 固定写 ' + sourceFixed + '。tags 和 genres 都是数组:一个素材能适配多个题材/标签时,把它们都写进去(例如 都市高武 → 都市、高武、都市高武)。');
|
|
201
224
|
lines.push('2. 命名/措辞/体例必须匹配题材文化体系,禁止跨题材串用后缀;都市类地名/势力/能力名优先写内层身份,表层日常伪装名写 note(最多 300 字)。');
|
|
225
|
+
lines.push('2.1 本次 facet 是交集:同一层多选全部同时成立;素材必须同时满足所有选中层,不能只取一部分。选中的 tropes / moods / settings / roles / relations 要原样写进对应数组。');
|
|
202
226
|
lines.push('3. tags 不能用质量评价词:精品、高价值、文笔好、强力、神秘。');
|
|
203
227
|
lines.push('4. 不要在文件里写 Markdown 代码围栏、标题、解释、前后缀。');
|
|
204
228
|
lines.push('5. 可以直接写 JSONL,也可以使用 Python/Node 生成器;生成器放 <工作区>/.tmp/,输出必须是目标 JSONL。');
|
|
@@ -253,6 +277,9 @@ export function generationRunText({
|
|
|
253
277
|
batches = 0,
|
|
254
278
|
total,
|
|
255
279
|
progressFile,
|
|
280
|
+
styles = [],
|
|
281
|
+
worldTitle = '',
|
|
282
|
+
flowFile = '',
|
|
256
283
|
aborted = false,
|
|
257
284
|
stopReason = '',
|
|
258
285
|
}) {
|
|
@@ -279,11 +306,18 @@ export function generationRunText({
|
|
|
279
306
|
lines.push('本次新增:' + importedTotal + ' 条');
|
|
280
307
|
if (Number.isFinite(total)) lines.push('库中素材:' + total + ' 条');
|
|
281
308
|
if (batches) lines.push('已导入批次:' + batches + ' 批');
|
|
309
|
+
if (worldTitle) lines.push('本次世界母体:' + worldTitle);
|
|
310
|
+
if (Array.isArray(styles) && styles.length) {
|
|
311
|
+
lines.push('本次风格:' + styles.map((style) => `${style.style_key}(${style.style_name})`).join('、'));
|
|
312
|
+
}
|
|
282
313
|
if (Number.isFinite(elapsedMs) && elapsedMs > 0) lines.push('耗时:' + formatDuration(elapsedMs));
|
|
283
314
|
if (stopReason) lines.push('停止原因:' + stopReason);
|
|
284
315
|
if (progressFile) lines.push('进度文件:' + progressFile);
|
|
316
|
+
if (flowFile) lines.push('世界状态:' + flowFile);
|
|
285
317
|
if (aborted || incomplete.length || notStarted.length || stopReason) {
|
|
286
|
-
lines.push('
|
|
318
|
+
lines.push('继续追加:/fancy-material continue(沿用本次世界母体);已导入素材不会撤销。');
|
|
319
|
+
} else {
|
|
320
|
+
lines.push('素材不够?运行 /fancy-material continue 沿用本次世界母体继续生成。');
|
|
287
321
|
}
|
|
288
322
|
return lines.join('\n');
|
|
289
323
|
}
|