chat: reconcile history by canonical message identity

This commit is contained in:
2026-10-19 00:08:30 +01:00
parent 3187b0c06e
commit 7da3d54013
13 changed files with 189 additions and 15 deletions
+9 -2
View File
@@ -102,6 +102,7 @@ func (s *chatSub) close() {
type chatQueuedPrompt struct {
text string
operationID string
nativeID string
requestID string
write func(protocol.Message) error
acked bool
@@ -659,8 +660,14 @@ func (h *chatHub) runTurn(room *chatRoom, p *chatQueuedPrompt, done chan struct{
return
}
}
if err := broker.Prompt(room.ctx, room.sessionID, p.text); err != nil {
h.failPrompt(room, p, err)
var promptErr error
if withID, ok := broker.(chatPromptWithMessageID); ok {
promptErr = withID.PromptWithMessageID(room.ctx, room.sessionID, p.text, p.nativeID)
} else {
promptErr = broker.Prompt(room.ctx, room.sessionID, p.text)
}
if promptErr != nil {
h.failPrompt(room, p, promptErr)
h.endRoomTurn(room)
return
}