chat: preserve cross-client reconciliation work
This commit is contained in:
@@ -54,16 +54,18 @@ func handleChatPrompt(ctx context.Context, request protocol.Message, broker chat
|
||||
// The user turn every *other* client sees, carrying the sender's label. The
|
||||
// sender's own client appended it locally, so it is excluded below.
|
||||
userFrame := protocol.ChatEventFrame{
|
||||
SessionID: sessionID,
|
||||
MessageID: hub.nextUserMessageID(),
|
||||
Kind: protocol.ChatEventUser,
|
||||
Part: &protocol.ChatPart{Type: protocol.ChatPartText, ID: "usr", Text: prompt.Text},
|
||||
Client: sub.label,
|
||||
SessionID: sessionID,
|
||||
MessageID: hub.nextUserMessageID(),
|
||||
Kind: protocol.ChatEventUser,
|
||||
Part: &protocol.ChatPart{Type: protocol.ChatPartText, ID: "usr", Text: prompt.Text},
|
||||
Client: sub.label,
|
||||
OperationID: prompt.OperationID,
|
||||
}
|
||||
queued, refused := hub.submitPrompt(sessionID, &chatQueuedPrompt{
|
||||
text: prompt.Text,
|
||||
requestID: request.ID,
|
||||
write: write,
|
||||
text: prompt.Text,
|
||||
operationID: prompt.OperationID,
|
||||
requestID: request.ID,
|
||||
write: write,
|
||||
})
|
||||
if refused {
|
||||
_ = write(protocol.Message{Type: protocol.Error, ID: request.ID, Error: "session " + sessionID + " already has the maximum number of prompts queued"})
|
||||
|
||||
Reference in New Issue
Block a user