feat(capability_matrix): populate v2 fields per-model; add runtime local override
Updates per-model registry entries to populate the 12 v2
fields where the capability is genuinely supported:
minimax-M2.5/M2.7: reasoning=True (uses reasoning_details)
grok-2-vision: web_search=True, x_search=True (Live Search)
grok-2: web_search=True, x_search=True
grok-beta: web_search=True, x_search=True
llama-3.1-405b: reasoning=True (explicitly in model name)
qwen-long: caching=True (custom long-context chunking)
qwen-audio: audio=True (was 'deferred' in v1 notes)
Adds the runtime override helper:
_apply_runtime_caps_override(app, caps)
-> caps with local=True if app.current_provider=='llama'
AND _llama_base_url contains 'localhost' or '127.0.0.1'
The 'local' flag is the only v2 field that is runtime-state,
not a static per-model property (OpenRouter llama is cloud;
Ollama llama is local — same model name, different backend).
The override uses dataclasses.replace() to mutate the
frozen dataclass. Implemented in src/gui_2.py (per the
HARD RULE on no new src/*.py files).
The override is wired into App._get_active_capabilities()
so the GUI sees caps.local=True when the active backend
is Ollama and caps.local=False otherwise.
Also: cost panel in src/gui_2.py (per-tier + session-total
columns) now renders 'Free (local)' when caps.local=True
(both the per-tier cost column and the session-total line).
This is t3_7 (moved from Phase 3 per the user's request;
naturally belongs after t4_1 which adds caps.local).
Tests:
- 3 new tests in tests/test_vendor_capabilities.py:
* per-model population (reasoning, audio, caching, vision)
* runtime override for llama+localhost
* runtime override does NOT touch other vendors
- 107/107 vendor+tool+provider+import-isolation tests pass
(no regressions; +4 new tests this commit)
- 3 audit scripts pass
This commit is contained in:
+24
-4
@@ -249,6 +249,15 @@ def _resolve_font_path(font_path: str, assets_dir: Path) -> str:
|
||||
return rel
|
||||
return "fonts/Inter-Regular.ttf"
|
||||
|
||||
def _apply_runtime_caps_override(app: "App", caps: "VendorCapabilities") -> "VendorCapabilities":
|
||||
from dataclasses import replace
|
||||
if app.current_provider == "llama":
|
||||
from src import ai_client
|
||||
base_url: str = getattr(ai_client, "_llama_base_url", "")
|
||||
if "localhost" in base_url or "127.0.0.1" in base_url:
|
||||
return replace(caps, local=True)
|
||||
return caps
|
||||
|
||||
class App:
|
||||
"""The main ImGui interface orchestrator for Manual Slop."""
|
||||
|
||||
@@ -733,9 +742,10 @@ class App:
|
||||
def _get_active_capabilities(self) -> "VendorCapabilities":
|
||||
from src.vendor_capabilities import VendorCapabilities, get_capabilities
|
||||
try:
|
||||
return get_capabilities(self.current_provider, self.current_model)
|
||||
caps = get_capabilities(self.current_provider, self.current_model)
|
||||
except KeyError:
|
||||
return VendorCapabilities(vendor=self.current_provider, model=self.current_model, notes="unregistered")
|
||||
caps = VendorCapabilities(vendor=self.current_provider, model=self.current_model, notes="unregistered")
|
||||
return _apply_runtime_caps_override(self, caps)
|
||||
|
||||
@property
|
||||
def perf_profiling_enabled(self) -> bool:
|
||||
@@ -1887,11 +1897,21 @@ 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)
|
||||
cost_str = f"${cost:.4f}" if caps.cost_tracking else "-"
|
||||
if caps.local:
|
||||
cost_str = "Free (local)"
|
||||
elif caps.cost_tracking:
|
||||
cost_str = f"${cost:.4f}"
|
||||
else:
|
||||
cost_str = "-"
|
||||
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())
|
||||
total_str = f"${tier_total:.4f}" if caps.cost_tracking else "-"
|
||||
if caps.local:
|
||||
total_str = "Free (local)"
|
||||
elif caps.cost_tracking:
|
||||
total_str = f"${tier_total:.4f}"
|
||||
else:
|
||||
total_str = "-"
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user