fix(gui): move heavy processing from render loop to controller - gui only visualizes state
This commit is contained in:
@@ -146,6 +146,7 @@ class AppController:
|
||||
self.mma_status: str = "idle"
|
||||
self._tool_log: List[Dict[str, Any]] = []
|
||||
self._tool_stats: Dict[str, Dict[str, Any]] = {} # {tool_name: {"count": 0, "total_time_ms": 0.0, "failures": 0}}
|
||||
self._cached_cache_stats: Dict[str, Any] = {} # Pre-computed cache stats for GUI
|
||||
self._comms_log: List[Dict[str, Any]] = []
|
||||
self.session_usage: Dict[str, Any] = {
|
||||
"input_tokens": 0,
|
||||
@@ -1740,6 +1741,17 @@ class AppController:
|
||||
count = cache_stats.get("cache_count", 0)
|
||||
size_bytes = cache_stats.get("total_size_bytes", 0)
|
||||
self._gemini_cache_text = f"Gemini Caches: {count} ({size_bytes / 1024:.1f} KB)"
|
||||
self._update_cached_stats()
|
||||
|
||||
def _update_cached_stats(self) -> None:
|
||||
import ai_client
|
||||
self._cached_cache_stats = ai_client.get_gemini_cache_stats()
|
||||
self._cached_tool_stats = dict(self._tool_stats)
|
||||
|
||||
def clear_cache(self) -> None:
|
||||
import ai_client
|
||||
ai_client.cleanup()
|
||||
self._update_cached_stats()
|
||||
|
||||
def _flush_to_project(self) -> None:
|
||||
proj = self.project
|
||||
|
||||
Reference in New Issue
Block a user