用户画像(跨会话、按登录用户隔离,只记称谓/行业/偏好三字段):新建/清空会话时把画像渲染文本+现取的近期关注(最近5条会话标题,不入库)冻结进sessions.profile_snapshot,buildMessages以system后首条user恒定注入(不入messages表故阶段归档/压缩免疫,字节恒定不破前缀缓存);唯一更新时机enterExecuting落槌——advising轮历史+当前画像+任务书快照喂一次模型调用(templates/profile-prompt.txt锁三字段JSON全量覆写语义:未提及原值拷回、被纠正才改写/清空),服务端按字段覆写、漏字段/解析失败保旧值,fire-and-forget永不抛出;user_profiles表(user主键,data JSON,enabled开关);/api/profile读写按req.user隔离,账户设置页新增用户画像子页(可见可改可停用,停用即清现存快照且不再提取);auth未启用=空串键隐式单用户

This commit is contained in:
2026-09-25 17:54:09 +08:00
parent 511c884e2b
commit 7708eea46a
10 changed files with 283 additions and 4 deletions
+8
View File
@@ -0,0 +1,8 @@
You maintain a minimal profile of the current user. The 【Current profile】 block in the last message is the stored state; your evidence is the planning conversation above plus the task brief appended with it.
Respond with JSON only — exactly {"honorific": "", "industry": "", "preference": ""}, no markdown fences, no prose. Output all three fields: this is a full-state update, not a diff.
- Carry every current value through UNCHANGED unless the conversation clearly replaces it or shows it is wrong; put "" only to clear a field the conversation invalidates (or one that is already empty). Never drop or rewrite a value on weak evidence.
- New non-empty values require clear evidence in the conversation; never guess, never infer personality, never record secrets or ID numbers.
- honorific: how the user wants to be addressed.
- industry: the user's industry/domain.
- preference: durable output preferences (reply language, delivery format, style) that would change the deliverable if unknown.
Write each non-empty value in {{language}}, at most 40 characters.