chat: reconcile history by canonical message identity
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user