Expose native chat compaction activity and retained replay
This commit is contained in:
@@ -64,14 +64,15 @@ type chatMessage struct {
|
||||
}
|
||||
|
||||
type chatTurn struct {
|
||||
sessionID string
|
||||
order []string
|
||||
messages map[string]*chatMessage
|
||||
step *protocol.ChatStep
|
||||
usage *protocol.ChatUsage
|
||||
size int
|
||||
overflow bool
|
||||
updated time.Time
|
||||
compaction *protocol.ChatCompaction
|
||||
sessionID string
|
||||
order []string
|
||||
messages map[string]*chatMessage
|
||||
step *protocol.ChatStep
|
||||
usage *protocol.ChatUsage
|
||||
size int
|
||||
overflow bool
|
||||
updated time.Time
|
||||
// permissions holds the request ids already pushed to the client so a
|
||||
// repeated poll cannot push the same pending request twice; permissionOrder
|
||||
// bounds it to chatPermissionRetainedLimit.
|
||||
@@ -143,7 +144,21 @@ func (h *chatHub) applyLocked(frame protocol.ChatEventFrame) {
|
||||
}
|
||||
turn := h.turnLocked(frame.SessionID)
|
||||
switch frame.Kind {
|
||||
case protocol.ChatEventCompaction:
|
||||
if frame.Compaction == nil {
|
||||
return
|
||||
}
|
||||
if frame.Compaction.Status == "running" {
|
||||
copy := *frame.Compaction
|
||||
turn.compaction = ©
|
||||
} else if turn.compaction != nil && (frame.Compaction.ID == "" || turn.compaction.ID == frame.Compaction.ID) {
|
||||
turn.compaction = nil
|
||||
}
|
||||
return
|
||||
case protocol.ChatEventStep:
|
||||
if frame.Step != nil && frame.Step.Status == protocol.ChatStepEnded && !frame.Step.Intermediate {
|
||||
turn.compaction = nil
|
||||
}
|
||||
turn.step = frame.Step
|
||||
return
|
||||
case protocol.ChatEventUsage:
|
||||
|
||||
Reference in New Issue
Block a user