加一套抓真实请求做预设对比的工具,并把三份预设的机制差异记进 README。
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// 看预设里某条目的正文开头与宏统计。用法: node peek-entry.mjs <preset.json> <identifier> [字数]
|
||||
import { readFileSync } from "node:fs";
|
||||
const [file, id, n] = process.argv.slice(2);
|
||||
const raw = JSON.parse(readFileSync(file, "utf8"));
|
||||
const p = (raw.prompts || []).find((x) => x.identifier === id);
|
||||
if (!p) { console.log("没有这个 identifier: " + id); process.exit(1); }
|
||||
const text = p.content || "";
|
||||
console.log("name=" + p.name + " role=" + p.role + " 字数=" + text.length);
|
||||
const macros = text.match(/\{\{[^}]*\}\}/g) || [];
|
||||
console.log("宏 " + macros.length + " 个: " + macros.slice(0, 12).join(" "));
|
||||
console.log("开头: " + text.slice(0, Number(n || 300)));
|
||||
console.log("结尾: " + text.slice(-200));
|
||||
Reference in New Issue
Block a user