Files
writing-agent/docs/direct-chat.md
T
chenmoranzhi 9dc927282f 预设兼容:按真实抓包对齐装配与包装层,补上声明式工具与预设正则。
- 装配只认 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:真假上游抓包对比工具、三份预设的机制结论与实测报告
2026-10-23 00:13:08 +08:00

43 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 直聊
与作品工作台「对话」并列的轻量多轮 LLM 面。请求始终由预设夹心包裹;不改动设置里的预设「试跑」。
## 两层
| 层 | 含义 | 落盘 |
|----|------|------|
| L1 上下文壳 | 系统提示、史前设定、种子历史、史后、尾注;可选绑定 `presetId`(缺省用全局选用预设) | `~/.writing-agent/direct-chats/shells/` |
| L2 会话 | 该壳下的多轮消息;助手消息可带 `contextTrace` 供对比 | `.../conversations/` |
| 临时会话 | 未选存档时的默认快速对话 | 仅浏览器 `localStorage`,最多 **2** 条;可「保存」升为持久 L1+L2 |
面包屑:`直聊 › {壳名\|临时} › {会话名}`。入口页:`/chat.html`。未选任何存档时中间即是快速对话,无单独「快速对话」按钮。
## 多模型窗口(竞技场)
- 标题栏「新增窗口」:中间按模型分栏(LMSYS Arena 式 side-by-side),每列独立对话流。
- 同一用户句在各列各显一份;发送时所有列并行 completion。
- 列内「保留此回复」:写入该轮 `selectedWindowId`;之后各列发下一轮时,本轮助手侧都以该回复进历史。保留后该轮界面只显示被保留的那张卡(再点「已保留 · 取消」恢复全部),下一轮仍是每个模型分别请求。
- 未保留:各列继续用自己的回复拼 prior。
## 请求
- 槽位 → WorldInfoPack;`chatHistory` = 种子历史 + 已落定多轮 transcript;本轮用户输入进 turn。
- 经 `PresetLlmProvider` 按选用/壳绑定预设夹心后发模型。
- 无选用预设:拒绝发送。
- 无 API Key:可只返回拼装结果。
## 多模型
助手消息保留 `contextTrace` 时,可对多个 API 配置并行重放,再「采用」写入 variants / branchIndex。临时会话需先保存再对比。
## API(节选)
- `GET/POST /api/direct-chat/shells`
- `GET/PATCH/DELETE /api/direct-chat/shells/:id`
- `POST /api/direct-chat/shells/:id/conversations`
- `GET/PATCH/DELETE /api/direct-chat/conversations/:id`
- `POST /api/direct-chat/conversations/:id/messages`
- `POST /api/direct-chat/ephemeral/complete`
- `POST /api/direct-chat/promote`
- `POST .../messages/:mid/compare`、`.../compare/adopt`