fix(gui): fix tool presets and biases panel and cache analytics section layout

This commit is contained in:
2026-03-11 00:25:04 -04:00
parent 3870bf086c
commit 7ee50f979a

View File

@@ -2483,9 +2483,7 @@ def hello():
if self.current_provider != "gemini":
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_cache_panel")
return
if not imgui.collapsing_header("Cache Analytics"):
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_cache_panel")
return
imgui.text_colored(C_LBL, 'Cache Analytics')
stats = getattr(self.controller, '_cached_cache_stats', {})
if not stats.get("cache_exists"):
imgui.text_disabled("No active cache")
@@ -3667,7 +3665,6 @@ def hello():
presets = self.controller.tool_presets
preset_names = [""] + sorted(list(presets.keys()))
# Gracefully handle None or missing preset
active = getattr(self, "ui_active_tool_preset", "")
if active is None: active = ""
try:
@@ -3685,6 +3682,20 @@ def hello():
if imgui.is_item_hovered():
imgui.set_tooltip("Configure tool availability and default modes.")
imgui.dummy(imgui.ImVec2(0, 4))
imgui.text("Bias Profile")
if imgui.begin_combo("##bias", getattr(self, 'ui_active_bias_profile', "") or "None"):
if imgui.selectable("None", not getattr(self, 'ui_active_bias_profile', ""))[0]:
self.ui_active_bias_profile = ""
from src import ai_client
ai_client.set_bias_profile(None)
for bname in sorted(self.controller.bias_profiles.keys()):
if imgui.selectable(bname, bname == getattr(self, 'ui_active_bias_profile', ""))[0]:
self.ui_active_bias_profile = bname
from src import ai_client
ai_client.set_bias_profile(bname)
imgui.end_combo()
imgui.dummy(imgui.ImVec2(0, 8))
active_name = self.ui_active_tool_preset
if active_name and active_name in presets:
@@ -3715,7 +3726,6 @@ def hello():
if imgui.radio_button(f"Ask##{cat_name}_{tool.name}", mode == "ask"):
tool.approval = "ask"
imgui.tree_pop()
def _render_theme_panel(self) -> None:
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_theme_panel")
exp, opened = imgui.begin("Theme", self.show_windows["Theme"])