feat(gui): Display active Gemini caches

This change adds a label to the Provider panel to show the count and total size of active Gemini caches when the Gemini provider is selected. This information is hidden for other providers.
This commit is contained in:
2026-02-23 13:42:57 -05:00
parent 84f05079e3
commit e747a783a5
2 changed files with 67 additions and 10 deletions

19
gui.py
View File

@@ -771,6 +771,7 @@ class App:
def _update_telemetry_panel(self):
"""Updates the token budget visualizer in the Provider panel."""
# Update history bleed stats for all providers
stats = ai_client.get_history_bleed_stats()
if dpg.does_item_exist("token_budget_bar"):
percentage = stats.get("percentage", 0.0)
@@ -780,6 +781,23 @@ class App:
limit = stats.get("limit", 0)
dpg.set_value("token_budget_label", f"{current:,} / {limit:,}")
# Update Gemini-specific cache stats
if dpg.does_item_exist("gemini_cache_label"):
if self.current_provider == "gemini":
try:
cache_stats = ai_client.get_gemini_cache_stats()
count = cache_stats.get("cache_count", 0)
size_bytes = cache_stats.get("total_size_bytes", 0)
size_kb = size_bytes / 1024.0
text = f"Gemini Caches: {count} ({size_kb:.1f} KB)"
dpg.set_value("gemini_cache_label", text)
dpg.configure_item("gemini_cache_label", show=True)
except Exception as e:
# If the API call fails, just hide the label
dpg.configure_item("gemini_cache_label", show=False)
else:
dpg.configure_item("gemini_cache_label", show=False)
def _append_comms_entry(self, entry: dict, idx: int):
if not dpg.does_item_exist("comms_scroll"):
return
@@ -1885,6 +1903,7 @@ class App:
dpg.add_text("History Token Budget:", color=_LABEL_COLOR)
dpg.add_progress_bar(tag="token_budget_bar", default_value=0.0, width=-1)
dpg.add_text("0 / 0", tag="token_budget_label")
dpg.add_text("", tag="gemini_cache_label", show=False)
dpg.add_separator()
dpg.add_text("Parameters")
dpg.add_input_float(tag="ai_temperature", label="Temperature", default_value=self.temperature, min_value=0.0, max_value=2.0)