23 lines
1.3 KiB
JavaScript
23 lines
1.3 KiB
JavaScript
// 打印预设里跟"机制"有关的顶层字段。用法: node peek-preset-flags.mjs <a.json> [b.json ...]
|
|
import { readFileSync } from "node:fs";
|
|
const keys = ["function_calling", "tool_call_recurse_limit", "tool_reasoning_mode", "squash_system_messages", "use_sysprompt", "sysprompt", "openai_max_context", "openai_max_tokens", "stream_openai", "show_thoughts", "reasoning_effort", "verbosity", "send_if_empty", "new_chat_prompt", "new_example_chat_prompt", "names_behavior", "assistant_prefill", "continue_prefill"];
|
|
for (const file of process.argv.slice(2)) {
|
|
const raw = JSON.parse(readFileSync(file, "utf8"));
|
|
console.log("=== " + file);
|
|
for (const k of keys) {
|
|
if (raw[k] === undefined) continue;
|
|
const v = JSON.stringify(raw[k]);
|
|
console.log(" " + k + ": " + (v.length > 120 ? v.slice(0, 120) + "…" : v));
|
|
}
|
|
const ext = raw.extensions;
|
|
if (ext) {
|
|
console.log(" extensions 顶层键: " + Object.keys(ext).join(", "));
|
|
const text = JSON.stringify(ext);
|
|
console.log(" extensions 里提到 tool 的片段: " + (text.match(/.{0,60}tool.{0,120}/gi) || []).slice(0, 3).join(" | "));
|
|
} else {
|
|
console.log(" extensions: 无");
|
|
}
|
|
const promptIds = (raw.prompts || []).map((p) => p.identifier);
|
|
console.log(" 含 tool 字样的条目: " + promptIds.filter((id) => String(id).includes("tool")).join(", "));
|
|
}
|