MCPcopy Create free account
hub / github.com/diillson/chatcli / warnIfHistoryExceedsProxyCap

Method warnIfHistoryExceedsProxyCap

cli/cli_llm.go:207–224  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

205// rejecting requests. Only meaningful when the user has not set an explicit
206// payload cap via DefaultCompactConfig.
207func (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
226func (cli *ChatCLI) handleProviderSelection(in string) {
227 availableProviders := cli.manager.GetAvailableProviders()

Calls 4

TFunction · 0.92
FormatPayloadSizeFunction · 0.85
WarnMethod · 0.80
SyncMethod · 0.80