@cloud411716/fancy-webnovel 4.0.0 → 4.0.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/package.json
CHANGED
|
@@ -15,11 +15,12 @@ import { readDeployedState, deployedStateProblemText, DEPLOYED_STATUS } from '#d
|
|
|
15
15
|
import { repairTopicDecision, selectNonRedundantBlocks, inspectBlockBodies } from '#topic-decision';
|
|
16
16
|
import { isSensitiveProjectPath, isValidProjectPath } from '#path-guard';
|
|
17
17
|
import { parseDecisionCandidates } from '#topic-candidates';
|
|
18
|
-
import { NOVEL_SUGGESTION_FILE, validateSuggestion, validateMinimalTopic, readSuggestion } from '#material-topic';
|
|
18
|
+
import { NOVEL_SUGGESTION_FILE, validateSuggestion, validateMinimalTopic, readSuggestion, ABILITY_KINDS, PLOT_KINDS } from '#material-topic';
|
|
19
19
|
import { atomicWriteJSON } from '#atomic-write';
|
|
20
20
|
import { resolveWorkspace } from '#workspace';
|
|
21
21
|
import { topic } from './templates.js';
|
|
22
22
|
import { deployMaterialTools } from '../fancy-material/tool-deploy.js';
|
|
23
|
+
import { countByKind } from '../fancy-material/inventory.js';
|
|
23
24
|
|
|
24
25
|
export const inject = ['commands', 'userQuestions', 'tools'];
|
|
25
26
|
|
|
@@ -482,6 +483,22 @@ async function pathSetup(ctx, session, invocation, signal, projectRoot) {
|
|
|
482
483
|
}));
|
|
483
484
|
}
|
|
484
485
|
|
|
486
|
+
// 没有能力/剧情素材时,不让 LLM 凭空编 5 个方案。
|
|
487
|
+
let counts = {};
|
|
488
|
+
try {
|
|
489
|
+
counts = await countByKind(projectRoot, [suggestion.genre]);
|
|
490
|
+
} catch { /* 查询失败时继续,让提示词里的查询给出具体错误 */ }
|
|
491
|
+
const abilityTotal = ABILITY_KINDS.reduce((sum, kind) => sum + (Number(counts[kind]) || 0), 0);
|
|
492
|
+
const plotTotal = PLOT_KINDS.reduce((sum, kind) => sum + (Number(counts[kind]) || 0), 0);
|
|
493
|
+
if (!abilityTotal || !plotTotal) {
|
|
494
|
+
return notify(session, 'error', topic.notify({
|
|
495
|
+
type: 'material_empty',
|
|
496
|
+
genre: suggestion.genre,
|
|
497
|
+
abilityTotal,
|
|
498
|
+
plotTotal,
|
|
499
|
+
}));
|
|
500
|
+
}
|
|
501
|
+
|
|
485
502
|
const prompt = topic.setupPrompt({
|
|
486
503
|
suggestion,
|
|
487
504
|
queryScript: tools.queryScript,
|
|
@@ -30,8 +30,9 @@ node '${QUERY_SCRIPT}' --workspace '${WORKSPACE}' --genre '${GENRE}' --kind <kin
|
|
|
30
30
|
1. 每个 kind 至少查询一次;用 `--json` 读取结果。
|
|
31
31
|
2. 只使用素材库里真实存在的素材;不要编造素材名或能力名。
|
|
32
32
|
3. 如果某个 kind 在该题材下没有结果,可以去掉 `--genre` 再查一次,优先选通用素材,并在方案里说明。
|
|
33
|
-
4.
|
|
34
|
-
5.
|
|
33
|
+
4. 如果某一组 kind 整体查不到任何素材,停止并告诉用户先运行 `/fancy-material 能力` 或 `/fancy-material 剧情` 补齐;不要编造素材。
|
|
34
|
+
5. 组合素材时保持因果自洽:能力机制、发动条件、代价、限制、反制、力量来源要能互相对上;剧情与脑洞要能落成具体冲突、反转或爽点。
|
|
35
|
+
6. 不要修改、删除 `.fancy-tools/fancy-material/` 下的脚本。
|
|
35
36
|
|
|
36
37
|
## 三、生成 5 个差异化方案
|
|
37
38
|
|
|
@@ -405,7 +405,7 @@ export const topic = {
|
|
|
405
405
|
/**
|
|
406
406
|
* 通知模板(左侧消息栏)
|
|
407
407
|
*/
|
|
408
|
-
notify({ type, platform, phase, decisionFile, blockCount, fieldCount, missing, err, projectRoot, extra, available, notes, file, reasons, arg, direction, genre, suggestionPath }) {
|
|
408
|
+
notify({ type, platform, phase, decisionFile, blockCount, fieldCount, missing, err, projectRoot, extra, available, notes, file, reasons, arg, direction, genre, suggestionPath, abilityTotal, plotTotal }) {
|
|
409
409
|
switch (type) {
|
|
410
410
|
case 'help':
|
|
411
411
|
return `📝 选题 用法
|
|
@@ -526,6 +526,17 @@ export const topic = {
|
|
|
526
526
|
case 'material_not_initialized':
|
|
527
527
|
return '⚠️ 当前工作区还没有初始化素材库。\n请先运行 /fancy-bootstrap 初始化工作区,或运行 /fancy-material init 补齐素材库 schema。';
|
|
528
528
|
|
|
529
|
+
case 'material_empty': {
|
|
530
|
+
const missing = [];
|
|
531
|
+
if (!abilityTotal) missing.push('能力类素材');
|
|
532
|
+
if (!plotTotal) missing.push('剧情与脑洞类素材');
|
|
533
|
+
return `⚠️ 素材库中「${genre || ''}」题材缺少${missing.join('和')}。\n` +
|
|
534
|
+
'请先补齐素材,再运行 /fancy-topic setup:\n' +
|
|
535
|
+
'- /fancy-material 能力\n' +
|
|
536
|
+
'- /fancy-material 剧情\n' +
|
|
537
|
+
'补齐后再回来生成 5 个候选方案。';
|
|
538
|
+
}
|
|
539
|
+
|
|
529
540
|
case 'setup_started':
|
|
530
541
|
return `✅ 已把素材驱动选题任务交给 LLM\n` +
|
|
531
542
|
`🏷️ 题材:${genre || ''}\n` +
|