diff --git a/src/gui_2.py b/src/gui_2.py index 8875ba45..02aff787 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -1887,10 +1887,12 @@ def render_token_budget_panel(app: App) -> None: imgui.table_set_column_index(0); render_selectable_label(app, f"tier_{tier}", tier, width=-1) imgui.table_set_column_index(1); render_selectable_label(app, f"model_{tier}", model.split("-")[0], width=-1) imgui.table_set_column_index(2); render_selectable_label(app, f"tokens_{tier}", f"{tokens:,}", width=-1) - imgui.table_set_column_index(3); render_selectable_label(app, f"cost_{tier}", f"${cost:.4f}", width=-1, color=theme.get_color("status_success")) + cost_str = f"${cost:.4f}" if caps.cost_tracking else "-" + imgui.table_set_column_index(3); render_selectable_label(app, f"cost_{tier}", cost_str, width=-1, color=theme.get_color("status_success")) imgui.end_table() tier_total = sum(cost_tracker.estimate_cost(stats.get('model', ''), stats.get('input', 0), stats.get('output', 0)) for stats in app.mma_tier_usage.values()) - render_selectable_label(app, "session_total_cost", f"Session Total: ${tier_total:.4f}", width=-1, color=theme.get_color("status_success")) + total_str = f"${tier_total:.4f}" if caps.cost_tracking else "-" + render_selectable_label(app, "session_total_cost", f"Session Total: {total_str}", width=-1, color=theme.get_color("status_success")) else: imgui.text_disabled("No MMA tier usage data") if stats.get("would_trim"): @@ -1908,13 +1910,17 @@ def render_token_budget_panel(app: App) -> None: imgui.text_disabled(f" [{role}] ~{toks:,} tokens") shown += 1 imgui.separator() - cache_stats = getattr(app.controller, '_cached_cache_stats', {}) - 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"Cache Usage: ACTIVE | Age: {age:.0f}s / {ttl}s | Renews at: {ttl * 0.9:.0f}s") + caps = app._get_active_capabilities() + if not caps.caching: + imgui.text_disabled(f"Cache Usage: N/A (not supported by {app.current_provider}/{app.current_model})") else: - imgui.text_disabled("Cache Usage: INACTIVE") + cache_stats = getattr(app.controller, '_cached_cache_stats', {}) + 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"Cache Usage: ACTIVE | Age: {age:.0f}s / {ttl}s | Renews at: {ttl * 0.9:.0f}s") + else: + imgui.text_disabled("Cache Usage: INACTIVE") if app.perf_profiling_enabled: app.perf_monitor.end_component("_render_token_budget_panel") #endregion: Diagnostics & Analytics @@ -2222,6 +2228,11 @@ def render_system_prompts_panel(app: App) -> None: ch, app.ui_project_system_prompt = imgui.input_text_multiline("##psp", app.ui_project_system_prompt, imgui.ImVec2(-1, 100)) def render_agent_tools_panel(app: App) -> None: + caps = app._get_active_capabilities() + if not caps.tool_calling: + if imgui.collapsing_header("Active Tool Presets & Biases", imgui.TreeNodeFlags_.default_open): + imgui.text_disabled(f"(tools not supported by {app.current_provider}/{app.current_model})") + return if imgui.collapsing_header("Active Tool Presets & Biases", imgui.TreeNodeFlags_.default_open): imgui.text("Tool Preset") presets = app.controller.tool_presets @@ -2312,10 +2323,12 @@ def render_provider_panel(app: App) -> None: _, app.temperature = imgui.input_float("Temp", app.temperature, 0.0, 0.0, "%.2f") imgui.pop_id() - # Top-P - imgui.push_id("top_p") + # Max Tokens + caps = app._get_active_capabilities() + max_tokens_cap = max(1, caps.context_window) + imgui.push_id("max_tokens") imgui.set_next_item_width(imgui.get_content_region_avail().x * 0.6) - _, app.top_p = imgui.slider_float("##slider", app.top_p, 0.0, 1.0, "%.2f") + _, app.max_tokens = imgui.slider_int("##slider", app.max_tokens, 1, max_tokens_cap) imgui.same_line() imgui.set_next_item_width(-1) _, app.top_p = imgui.input_float("Top-P", app.top_p, 0.0, 0.0, "%.2f")