refactor(gui): redesign AI settings and usage analytics UI
This commit is contained in:
63
src/gui_2.py
63
src/gui_2.py
@@ -2252,38 +2252,6 @@ def hello():
|
||||
|
||||
def _render_provider_panel(self) -> None:
|
||||
if self.perf_profiling_enabled: self.perf_monitor.start_component("_render_provider_panel")
|
||||
imgui.text("Provider")
|
||||
if imgui.begin_combo("##prov", self.current_provider):
|
||||
for p in PROVIDERS:
|
||||
if imgui.selectable(p, p == self.current_provider)[0]:
|
||||
self.current_provider = p
|
||||
imgui.end_combo()
|
||||
imgui.separator()
|
||||
imgui.text("Model")
|
||||
imgui.same_line()
|
||||
if imgui.button("Fetch Models"):
|
||||
self._fetch_models(self.current_provider)
|
||||
if imgui.begin_list_box("##models", imgui.ImVec2(-1, 120)):
|
||||
for m in self.available_models:
|
||||
if imgui.selectable(m, m == self.current_model)[0]:
|
||||
self.current_model = m
|
||||
imgui.end_list_box()
|
||||
imgui.separator()
|
||||
imgui.text("Parameters")
|
||||
ch, self.temperature = imgui.slider_float("Temperature", self.temperature, 0.0, 2.0, "%.2f")
|
||||
ch, self.max_tokens = imgui.input_int("Max Tokens (Output)", self.max_tokens, 1024)
|
||||
ch, self.history_trunc_limit = imgui.input_int("History Truncation Limit", self.history_trunc_limit, 1024)
|
||||
imgui.text("Bias Profile")
|
||||
if imgui.begin_combo("##bias", self.ui_active_bias_profile or "None"):
|
||||
if imgui.selectable("None", not self.ui_active_bias_profile)[0]:
|
||||
self.ui_active_bias_profile = ""
|
||||
ai_client.set_bias_profile(None)
|
||||
for bname in sorted(self.bias_profiles.keys()):
|
||||
if imgui.selectable(bname, bname == self.ui_active_bias_profile)[0]:
|
||||
self.ui_active_bias_profile = bname
|
||||
ai_client.set_bias_profile(bname)
|
||||
imgui.end_combo()
|
||||
|
||||
imgui.text("Persona")
|
||||
if not hasattr(self, 'ui_active_persona'):
|
||||
self.ui_active_persona = ""
|
||||
@@ -2316,7 +2284,7 @@ def hello():
|
||||
if persona.max_output_tokens:
|
||||
ai_client.max_output_tokens = persona.max_output_tokens
|
||||
if persona.system_prompt:
|
||||
ai_client.system_instruction = persona.system_prompt
|
||||
self.ui_project_system_prompt = persona.system_prompt
|
||||
if persona.tool_preset:
|
||||
self.ui_active_tool_preset = persona.tool_preset
|
||||
ai_client.set_tool_preset(persona.tool_preset)
|
||||
@@ -2352,6 +2320,28 @@ def hello():
|
||||
self._editing_persona_preferred_models_list = []
|
||||
self._editing_persona_scope = "project"
|
||||
self._editing_persona_is_new = True
|
||||
imgui.separator()
|
||||
imgui.text("Provider")
|
||||
if imgui.begin_combo("##prov", self.current_provider):
|
||||
for p in PROVIDERS:
|
||||
if imgui.selectable(p, p == self.current_provider)[0]:
|
||||
self.current_provider = p
|
||||
imgui.end_combo()
|
||||
imgui.separator()
|
||||
imgui.text("Model")
|
||||
if imgui.begin_list_box("##models", imgui.ImVec2(-1, 120)):
|
||||
for m in self.available_models:
|
||||
if imgui.selectable(m, m == self.current_model)[0]:
|
||||
self.current_model = m
|
||||
imgui.end_list_box()
|
||||
imgui.separator()
|
||||
imgui.text("Parameters")
|
||||
ch, self.temperature = imgui.slider_float("Temperature", self.temperature, 0.0, 2.0, "%.2f")
|
||||
ch, self.max_tokens = imgui.input_int("Max Tokens (Output)", self.max_tokens, 1024)
|
||||
ch, self.history_trunc_limit = imgui.input_int("History Truncation Limit", self.history_trunc_limit, 1024)
|
||||
|
||||
|
||||
|
||||
if self.current_provider == "gemini_cli":
|
||||
imgui.separator()
|
||||
imgui.text("Gemini CLI")
|
||||
@@ -2475,9 +2465,9 @@ def hello():
|
||||
if cache_stats.get("cache_exists"):
|
||||
age = cache_stats.get("cache_age_seconds", 0)
|
||||
ttl = cache_stats.get("ttl_seconds", 3600)
|
||||
imgui.text_colored(C_LBL, f"Gemini Cache: ACTIVE | Age: {age:.0f}s / {ttl}s | Renews at: {ttl * 0.9:.0f}s")
|
||||
imgui.text_colored(C_LBL, f"Cache Usage: ACTIVE | Age: {age:.0f}s / {ttl}s | Renews at: {ttl * 0.9:.0f}s")
|
||||
else:
|
||||
imgui.text_disabled("Gemini Cache: INACTIVE")
|
||||
imgui.text_disabled("Cache Usage: INACTIVE")
|
||||
if self.perf_profiling_enabled: self.perf_monitor.end_component("_render_token_budget_panel")
|
||||
|
||||
def _render_cache_panel(self) -> None:
|
||||
@@ -3662,7 +3652,8 @@ def hello():
|
||||
imgui.set_item_tooltip("Open preset management modal")
|
||||
ch, self.ui_project_system_prompt = imgui.input_text_multiline("##psp", self.ui_project_system_prompt, imgui.ImVec2(-1, 100))
|
||||
def _render_agent_tools_panel(self) -> None:
|
||||
imgui.text_colored(C_LBL, 'Active Tool Preset')
|
||||
if imgui.collapsing_header("Active Tool Presets & Biases", imgui.TreeNodeFlags_.default_open):
|
||||
imgui.text("Tool Preset")
|
||||
presets = self.controller.tool_presets
|
||||
preset_names = [""] + sorted(list(presets.keys()))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user