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

25 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 列出预设里所有正则脚本的开关(判断是否影响请求体)
import { readFileSync } from "node:fs";
const preset = JSON.parse(readFileSync(process.argv[2], "utf8"));
const rows = [];
for (const r of preset.extensions?.regex_scripts || []) rows.push({ from: "regex_scripts", ...r });
for (const r of preset.extensions?.SPreset?.RegexBinding?.regexes || []) rows.push({ from: "SPreset.RegexBinding", ...r });
console.log("共 " + rows.length + " 条");
for (const r of rows) {
console.log(
[
r.from,
(r.scriptName || r.id || "").slice(0, 24),
"promptOnly=" + r.promptOnly,
"markdownOnly=" + r.markdownOnly,
"disabled=" + r.disabled,
"depth=" + r.minDepth + "/" + r.maxDepth,
"repl=" + String(r.replaceString || "").length,
].join(" "),
);
}
const send = rows.filter((r) => r.promptOnly === true && r.disabled !== true);
const display = rows.filter((r) => r.markdownOnly === true);
console.log("\n影响请求体(promptOnly=true 且未禁用): " + send.length + " 条");
console.log("纯显示(markdownOnly=true): " + display.length + " 条");