加一套抓真实请求做预设对比的工具,并把三份预设的机制差异记进 README。

This commit is contained in:
2026-10-22 20:07:33 +08:00
parent 18f034bc2d
commit ed09e5c831
21 changed files with 1735 additions and 0 deletions
@@ -0,0 +1,22 @@
// 打印预设 prompt_order 里每条的关键字段,便于解释抓包差异。
// 用法: node inspect-prompt-order.mjs "C:/Users/zed/Downloads/linux_1.3.json"
import { readFileSync } from "node:fs";
const file = process.argv[2];
const raw = JSON.parse(readFileSync(file, "utf8"));
const prompts = raw.prompts || [];
const blocks = raw.prompt_order || [];
const block = blocks.find((b) => b.character_id === 100001) || blocks[0] || { order: [] };
const byId = new Map();
prompts.forEach((p, i) => byId.set(p.identifier || String(i), p));
console.log("prompt_order 套数: " + blocks.length + ", 选用 character_id=" + block.character_id);
console.log("idx | enabled | identifier | role | marker | system_prompt | forbid_overrides | inj(pos/depth/order) | 字数 | name");
(block.order || []).forEach((item, i) => {
const p = byId.get(item.identifier) || {};
const inj = [p.injection_position, p.injection_depth, p.injection_order].join("/");
console.log([i, item.enabled, item.identifier, p.role, p.marker, p.system_prompt, p.forbid_overrides, inj, (p.content || "").length, p.name].join(" | "));
});
const inOrder = new Set((block.order || []).map((x) => x.identifier));
const orphans = prompts.filter((p) => !inOrder.has(p.identifier));
if (orphans.length) console.log("不在 order 里的: " + orphans.map((p) => p.identifier).join(", "));