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

Method showConfigCompression

cli/config_compression_mutate.go:198–234  ·  view source on GitHub ↗

showConfigCompression renders the compression panorama.

()

Source from the content-addressed store, hash-verified

196
197// showConfigCompression renders the compression panorama.
198func (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.
237func (cli *ChatCLI) showCompressionStats() {

Callers 1

Calls 15

TFunction · 0.92
sectionHeaderFunction · 0.85
uiPrefixFunction · 0.85
envOrDefaultFunction · 0.85
ccrStoreSummaryFunction · 0.85
colorizeFunction · 0.85
sectionEndFunction · 0.85
ProfileMethod · 0.80
ThresholdMethod · 0.80
StoreFallbackMethod · 0.80
ModeMethod · 0.65
StatsMethod · 0.65

Tested by

no test coverage detected