style(memory,wechat,profile): 三段开场注入统一 AI 友好记号体例
- 块标题统一「# [CTX] user_profile / channel / memory」,模型按标题辨源; memory 头文案同步精简(去「系统随新工作台自动带来」等对人解释句) - 记忆条目改「## id=…, day=…」逐片自描述,分天组头「=== day ===」退役 (id/day 进标题即机器可读,recall 结果行顺带去重日期) - 已验证:journalFor 真实渲染与目标格式一致;node --check ×3 通过 - 注:旧会话已冻结的 profile_snapshot / 已入库 note 行为旧文案,新会话起生效
This commit is contained in:
@@ -20,7 +20,9 @@ const SET_MAX = 20; // AI 写 honorific/industry 的单值帽(称谓应当
|
||||
const TAG_MAX = 15; // 单个偏好标签长度帽
|
||||
const TAGS_MAX = 24; // 偏好标签数量帽
|
||||
const TAG_SPLIT = /[、,,;;\n]+/;
|
||||
const SNAPSHOT_HEAD = '【用户画像】以下为历史会话沉淀的粗粒度认知,非任务约束;与当前请求冲突时,一律以当前请求为准。';
|
||||
// 画像快照头:AI 友好的分块标记(与 channel_note/memory_note 同款「# [CTX] <名>」体例,
|
||||
// buildMessages 把快照作 system 后首条 user 注入,标题即自描述来源)。
|
||||
const SNAPSHOT_HEAD = '# [CTX] user_profile\n\n以下为历史会话沉淀的粗粒度认知,非任务约束;与当前请求冲突时,一律以当前请求为准。';
|
||||
const FIELD_LABELS = { honorific: '称谓', industry: '行业', preference: '偏好' };
|
||||
|
||||
function readRow(db, user) {
|
||||
@@ -145,7 +147,7 @@ function snapshotText(db, user) {
|
||||
if (!p.enabled) return '';
|
||||
const lines = [];
|
||||
for (const k of FIELDS) if (p[k]) lines.push('- ' + FIELD_LABELS[k] + ':' + p[k]);
|
||||
return lines.length ? SNAPSHOT_HEAD + '\n' + lines.join('\n') : '';
|
||||
return lines.length ? SNAPSHOT_HEAD + '\n\n' + lines.join('\n') : '';
|
||||
}
|
||||
|
||||
// 会话创建/清空时冻结画像快照。失败静默(大不了这轮不注入,不影响建会话/清空主流程)。
|
||||
|
||||
Reference in New Issue
Block a user