diff --git a/internal/adapters/chat/chat.go b/internal/adapters/chat/chat.go index 8cd0610..a774260 100644 --- a/internal/adapters/chat/chat.go +++ b/internal/adapters/chat/chat.go @@ -41,6 +41,11 @@ type Request struct { Transcript string History []Turn Question string + // MaxChars, when positive, overrides the Service's transcript budget for this + // request. The Service default is sized for YouTube captions (~22 minutes of + // speech); an uploaded recording is much longer, and truncation keeps only the + // head (ADR-033). Zero or negative means "use the Service default". + MaxChars int } // Reply is the model's answer plus whether the transcript was bounded to fit the @@ -113,7 +118,11 @@ func (s *Service) Answer(ctx context.Context, req Request) (Reply, error) { model = s.DefaultModel("") } - transcript, truncated := truncate(req.Transcript, s.maxChars) + budget := s.maxChars + if req.MaxChars > 0 { + budget = req.MaxChars + } + transcript, truncated := truncate(req.Transcript, budget) system := buildSystem(transcript, truncated) user := buildUser(req.History, req.Question)