Files
TradarrV2/backend/internal/summaryqa/context.go

12 lines
401 B
Go

package summaryqa
// ContextBytes measures the original UTF-8 content, not rune count or JSON
// escaping. Both adapters use the same bound and must never trim chat context.
func (r StatelessRequest) ContextBytes() int {
size := len(r.Summary) + len(r.Passage) + len(r.Question)
for _, turn := range r.History {
size += len(turn.Passage) + len(turn.Question) + len(turn.Answer)
}
return size
}