feat(gateway): D3 审查读侧/revert 端点 + 语音用户可见面(L45)
(a) 记忆入库前审查的两条 admin 端点(主人判「有必要就做」):
GET /api/v1/admin/memories/reviews?limit= (留痕读侧,不含记忆正文)
POST /api/v1/admin/memories/{id}/revert (回滚软合并,落审计 memory.review.revert)
两条 writeAuth(裁定 DECISIONS #10:留痕属私有面,不给 viewer)
(b) 语音用户可见面:DTO voice(含服务端派生 url)+ GET /api/v1/media/{name}
(200/206/304/416/HEAD、Accept-Ranges、非法名/穿越统一 404 media_not_found)
+ documents.Store.SaveAudio(内容寻址、$DATA_DIR 0600)+ history voice 列读写与引用计数差动
缺口(如实):message_persisted/握手回放仍不带 voice(文件面外,需给 history.Message 加字段);
AMR 需一行 VoiceTranscoder 注入(DECISIONS #11 已排)。4 个变异自检(含一条自认的等价变异)。
This commit is contained in:
1 parent
4a937bd269
commit
1420e8aaa6
15 files changed
+2202
-5
No files matched your search
@@ -119,7 +119,10 @@ type historyMessage struct {
|
||||
// 它**只由读接口填充**(`handleListMessages`):其余共用本结构的出口
|
||||
// (`message_persisted` / `message_edited` / 握手回放 / 渠道日志)逐字不变。
|
||||
ToolCalls []historyToolCall `json:"toolCalls,omitempty"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
// Voice 是这条消息的**语音面**(契约 v0.67 §4.4;形状与缺席语义见 history_voice.go):
|
||||
// 非语音消息**整键缺席**(指针 nil,不是 `{}` 也不是 `null`)⇒ **🎤 判据 = 本键存在**。
|
||||
Voice *historyVoice `json:"voice,omitempty"`
|
||||
CreatedAt int64 `json:"createdAt"`
|
||||
}
|
||||
|
||||
// handleHistorySessions 先返回主会话,再返回每个子会话(最旧
|
||||
@@ -299,6 +302,8 @@ func (s *Server) handleListMessages(w http.ResponseWriter, r *http.Request) {
|
||||
// (按页内路标识集合,禁 N+1)。图取不到 ⇒ 字段整体缺席(attachToolCalls 只在
|
||||
// 真的回看到工具调用时才写),绝不回空数组。
|
||||
s.attachToolCalls(r.Context(), id, out)
|
||||
// 语音面(契约 v0.67 §4.4):同样一次批量读列,列里没有语音事实 ⇒ 整体缺席。
|
||||
s.attachVoice(r.Context(), out)
|
||||
writeJSON(w, http.StatusOK, out)
|
||||
}
|
||||
|
||||
@@ -360,6 +365,8 @@ func (s *Server) handleChannelPlatformLog(w http.ResponseWriter, r *http.Request
|
||||
for _, m := range msgs {
|
||||
out = append(out, toHistoryMessage(m))
|
||||
}
|
||||
// 语音面(契约 v0.67 §4.4):渠道日志页也是读取面,同样补(一次批量)。
|
||||
s.attachVoice(r.Context(), out)
|
||||
writeJSON(w, http.StatusOK, out)
|
||||
}
|
||||
|
||||
@@ -417,6 +424,8 @@ func (s *Server) handleChannelMessages(w http.ResponseWriter, r *http.Request) {
|
||||
for _, m := range msgs {
|
||||
out = append(out, toHistoryMessage(m))
|
||||
}
|
||||
// 语音面(契约 v0.67 §4.4):IM 适配器日志页也是读取面之一,同样补(一次批量)。
|
||||
s.attachVoice(r.Context(), out)
|
||||
writeJSON(w, http.StatusOK, out)
|
||||
}
|
||||
func (s *Server) handleDeleteSession(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
Reference in new issue
Block a user