Load the lead's scrollback 50 turns at a time

This commit is contained in:
Ian Gulliver
2026-10-16 18:11:00 -07:00
parent 5dddc15ab9
commit 859aa2dd8b
20 changed files with 625 additions and 238 deletions
+19
View File
@@ -2,6 +2,7 @@ package server
import (
"errors"
"math"
"net/http"
"strings"
@@ -17,6 +18,24 @@ func (s *Server) ListLeadSessions(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, sessions)
}
func (s *Server) ListLeadEvents(w http.ResponseWriter, r *http.Request, params api.ListLeadEventsParams) {
before := int64(math.MaxInt64)
if params.Before != nil {
before = *params.Before
}
turns := 50
if params.Turns != nil {
turns = *params.Turns
}
page, err := s.store.LeadEventsPage(r.Context(), actor(r), before, turns)
if err != nil {
writeStoreError(w, err)
return
}
writeJSON(w, http.StatusOK, page)
}
func (s *Server) MessageLead(w http.ResponseWriter, r *http.Request) {
req := api.MessageCreate{}
if !readJSON(w, r, &req) {