warnIfHistoryExceedsProxyCap fires a once-per-session notice when the uncompacted history is large enough that a corporate proxy could start rejecting requests. Only meaningful when the user has not set an explicit payload cap via DefaultCompactConfig.
(cfg CompactConfig)
| 205 | // rejecting requests. Only meaningful when the user has not set an explicit |
| 206 | // payload cap via DefaultCompactConfig. |
| 207 | func (cli *ChatCLI) warnIfHistoryExceedsProxyCap(cfg CompactConfig) { |
| 208 | if cfg.MaxPayloadBytes != 0 || cli.proxyPayloadWarned { |
| 209 | return |
| 210 | } |
| 211 | totalChars := 0 |
| 212 | for _, m := range cli.history { |
| 213 | totalChars += len(m.Content) |
| 214 | } |
| 215 | if totalChars <= 2_500_000 { |
| 216 | return |
| 217 | } |
| 218 | cli.proxyPayloadWarned = true |
| 219 | cli.logger.Warn("Chat history exceeds 2.5 MB, no payload cap set", |
| 220 | zap.Int("total_chars", totalChars)) |
| 221 | fmt.Printf("\r\033[K ℹ %s\n", |
| 222 | i18n.T("agent.preflight.warn_no_cap", FormatPayloadSize(totalChars))) |
| 223 | _ = os.Stdout.Sync() |
| 224 | } |
| 225 | |
| 226 | func (cli *ChatCLI) handleProviderSelection(in string) { |
| 227 | availableProviders := cli.manager.GetAvailableProviders() |