预设兼容:按真实抓包对齐装配与包装层,补上声明式工具与预设正则。
- 装配只认 prompt_order.enabled;squash_system_messages 只合并相邻 system(新增 system 档,连接符按酒馆用单换行)
- 包装层:new_chat_prompt、示例对话(new_example_chat_prompt + <START> 切段 + name)、角色卡三块与 personality_format/scenario_format、{{user}}/{{char}} 取值、任务契约并进预设条目
- 工具协议:按 ToolBindings / 伪工具协议数据声明真 tools(presetToolPolicy=preset),工具描述用到的条目不再重复作为消息发出
- 正则:promptOnly 作用于对话历史(含 depth 过滤)、写入时脚本改写回复;{{//}} 注释按配平扫描
- tools/st-request-diff:真假上游抓包对比工具、三份预设的机制结论与实测报告
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// 看工具模式下两边的消息条数/字数,以及"工具说明/字段说明"有没有既进消息又进 tools 描述(重复)。
|
||||
import { readFileSync } from "node:fs";
|
||||
for (const file of process.argv.slice(2)) {
|
||||
const body = JSON.parse(JSON.parse(readFileSync(file, "utf8")).body);
|
||||
const msgs = body.messages || [];
|
||||
const total = msgs.reduce((n, m) => n + String(m.content ?? "").length, 0);
|
||||
const desc = (body.tools || []).map((t) => String(t.function?.description ?? "").length);
|
||||
const paramDesc = (body.tools || []).flatMap((t) => Object.values(t.function?.parameters?.properties ?? {}).map((p) => String(p.description ?? "").length));
|
||||
const hitDesc = msgs.some((m) => String(m.content ?? "").includes("POSIX Terminal Screen Kernel Configuration"));
|
||||
const hitParam = msgs.some((m) => String(m.content ?? "").includes("terminal_payload_contract"));
|
||||
console.log(file.split("/").pop());
|
||||
console.log(" messages=" + msgs.length + " 正文合计=" + total + " 字; tools=" + (body.tools || []).length + " 工具描述=" + desc.join(",") + " 参数描述=" + paramDesc.join(","));
|
||||
console.log(" 工具说明也在 messages 里? " + hitDesc + "; 字段说明也在 messages 里? " + hitParam);
|
||||
}
|
||||
Reference in New Issue
Block a user