showConfigCompression renders the compression panorama.
()
| 196 | |
| 197 | // showConfigCompression renders the compression panorama. |
| 198 | func (cli *ChatCLI) showConfigCompression() { |
| 199 | sectionHeader("🗜️", "cfg.section.compression.title", ColorBlue) |
| 200 | p := uiPrefix(ColorBlue) |
| 201 | |
| 202 | mode := "off" |
| 203 | if cli.compressionLayer != nil { |
| 204 | mode = cli.compressionLayer.Mode().String() |
| 205 | } |
| 206 | kv(p, i18n.T("cfg.compression.mode"), mode) |
| 207 | profile := compress.ProfileDefault.String() |
| 208 | threshold := fmt.Sprintf("%d", compress.DefaultThreshold) |
| 209 | if cli.compressionLayer != nil { |
| 210 | profile = cli.compressionLayer.Profile().String() |
| 211 | threshold = fmt.Sprintf("%d", cli.compressionLayer.Threshold()) |
| 212 | } |
| 213 | kv(p, i18n.T("cfg.compression.profile"), profile) |
| 214 | kv(p, "CHATCLI_COMPRESSION_THRESHOLD", threshold) |
| 215 | kv(p, "CHATCLI_COMPRESSION_CCR_DIR", envOrDefault("CHATCLI_COMPRESSION_CCR_DIR", "~/.chatcli/ccr")) |
| 216 | kv(p, "CHATCLI_COMPRESSION_CCR_MAX_MB", envOrDefault("CHATCLI_COMPRESSION_CCR_MAX_MB", "256")) |
| 217 | kv(p, "CHATCLI_COMPRESSION_CCR_TTL", envOrDefault("CHATCLI_COMPRESSION_CCR_TTL", "168h")) |
| 218 | |
| 219 | if cli.compressionLayer != nil { |
| 220 | stats, store := cli.compressionLayer.Stats() |
| 221 | kv(p, i18n.T("cfg.compression.saved"), |
| 222 | fmt.Sprintf("%d/%d bytes (%.0f%%)", stats.SavedBytes(), stats.BytesIn, (1-stats.Ratio())*100)) |
| 223 | kv(p, i18n.T("cfg.compression.ccr_store"), ccrStoreSummary(store)) |
| 224 | if err := cli.compressionLayer.StoreFallback(); err != nil { |
| 225 | kv(p, i18n.T("cfg.compression.store_backend"), |
| 226 | colorize(i18n.T("cfg.compression.store_memory_fallback", err.Error()), ColorYellow)) |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | fmt.Println(p) |
| 231 | fmt.Println(p + colorize(i18n.T("cfg.compression.about"), ColorGray)) |
| 232 | fmt.Println(p + colorize(i18n.T("cfg.compression.change_hint"), ColorGray)) |
| 233 | sectionEnd(ColorBlue) |
| 234 | } |
| 235 | |
| 236 | // showCompressionStats prints the detailed per-strategy savings summary. |
| 237 | func (cli *ChatCLI) showCompressionStats() { |
no test coverage detected