Files
writing-agent/tools/st-request-diff/pick-blocks.mjs
chenmoranzhi 1a5ef3b2bc 抓包对比工具补一批一次性脚本:拆预设、对请求、跑 A/B 与拒答抽样。
这些脚本都是我对着酒馆真实请求手工核对用的,留在仓库里方便下次重跑;跑出来的本地数据目录含接口 key,已经写进忽略规则。
2026-10-26 01:09:56 +08:00

15 lines
799 B
JavaScript

// 按名字挑出预设里的 block,打印正文(用于提炼自研预设)
// 用法: node pick-blocks.mjs <preset.json> <每个最多打印字数> <名字片段1> [片段2...]
import { readFileSync } from "node:fs";
const preset = JSON.parse(readFileSync(process.argv[2], "utf8"));
const limit = Number(process.argv[3]);
const keys = process.argv.slice(4);
for (const p of preset.prompts || []) {
const name = String(p.name || p.identifier || "");
if (!keys.some((k) => name.includes(k))) continue;
const body = String(p.content || "");
console.log("\n===== " + name + " (" + body.length + " 字, role=" + (p.role || "system") + ") =====");
console.log(body.slice(0, limit));
if (body.length > limit) console.log("…(截断,余 " + (body.length - limit) + " 字)");
}