预设兼容:按真实抓包对齐装配与包装层,补上声明式工具与预设正则。
- 装配只认 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:
@@ -3,10 +3,11 @@ import type { DictateChatTurn } from "./types.js";
|
||||
/**
|
||||
* 创作上下文保留的更早对话轮数。
|
||||
* 1 轮 = 一次用户输入 + 一次助手输出(不含本轮正在处理的末句用户话)。
|
||||
* 默认 2;0 = 不保留更早对话;负数 = 不限制。
|
||||
* 负数 = 不限制。(当前缺省即不限制:块级滑窗会让整段前缀位移、击穿缓存,
|
||||
* 先关掉以便量真多轮之后的首填命中,见 docs/briefs/prompt-cache-audit-2026-10-07.md)
|
||||
* 可用环境变量 `DICTATE_HISTORY_TURNS` 或调用参数覆盖。
|
||||
*/
|
||||
export const DEFAULT_DICTATE_HISTORY_TURNS = 2;
|
||||
export const DEFAULT_DICTATE_HISTORY_TURNS = -1;
|
||||
|
||||
export function resolveDictateHistoryTurns(override?: number): number {
|
||||
if (typeof override === "number" && Number.isFinite(override)) {
|
||||
@@ -22,7 +23,7 @@ export function resolveDictateHistoryTurns(override?: number): number {
|
||||
|
||||
/**
|
||||
* 裁剪进模型的对话:保留末句用户输入 + 最近 `historyTurns` 轮更早问答。
|
||||
* `historyTurns < 0` 时原样返回。
|
||||
* `historyTurns < 0` 时原样返回(= 不限制,当前缺省)。
|
||||
*/
|
||||
export function clipDictateDialogue(
|
||||
dialogue: DictateChatTurn[],
|
||||
|
||||
Reference in New Issue
Block a user