Expose recorded background task timing and progress metadata
This commit is contained in:
@@ -26,7 +26,9 @@ func (s *ShellSnapshot) Record(shell *protocol.ChatShell) {
|
||||
s.changes = make(map[string]protocol.ChatShell)
|
||||
}
|
||||
old := s.changes[shell.ID]
|
||||
n := s.bytes - len(old.ID) - len(old.Command) + len(shell.ID) + len(shell.Command)
|
||||
merged := protocol.PreserveChatShellMetadata(*shell, old)
|
||||
shell = &merged
|
||||
n := s.bytes - len(old.ID) - protocol.ChatShellRetainedBytes(old) + len(shell.ID) + protocol.ChatShellRetainedBytes(*shell)
|
||||
if n > MaxResponse || (old.ID == "" && len(s.changes) >= chatShellIdentityLimit) {
|
||||
s.overflow = true
|
||||
return
|
||||
@@ -51,7 +53,7 @@ func (s *ShellSnapshot) Merge(shells []protocol.ChatShell) ([]protocol.ChatShell
|
||||
}
|
||||
for id, shell := range s.changes {
|
||||
if shell.Status == protocol.ChatShellRunning {
|
||||
byID[id] = shell
|
||||
byID[id] = protocol.PreserveChatShellMetadata(shell, byID[id])
|
||||
} else {
|
||||
delete(byID, id)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user