From 84ca734a124e1defba6e6f21b1324421dc0a356a Mon Sep 17 00:00:00 2001 From: Ed_ Date: Thu, 25 Jun 2026 20:30:44 -0400 Subject: [PATCH] refactor(gui_2): migrate DiscussionSettings consumer (Phase 10 batch 2) Phase 10 (batch 2): DiscussionSettings Before: 1 .get('temperature'/...) site in src/gui_2.py After: 0 Delta: -1 (plan expected 3 sites; 2 were already migrated by Tier 2) Migrates the summary line in persona preferred model rendering: entry.get('temperature', 0.7) entry.get('top_p', 1.0) entry.get('max_output_tokens', 0) to: ds = DiscussionSettings.from_dict(entry) if isinstance(entry, dict) else ds ds.temperature, ds.top_p, ds.max_output_tokens The dataclass defaults match the original .get() defaults exactly (temperature=0.7, top_p=1.0, max_output_tokens=0), so behavior is preserved. --- src/gui_2.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui_2.py b/src/gui_2.py index 48d82378..7925c4db 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -3536,7 +3536,9 @@ def render_persona_editor_window(app: App, is_embedded: bool = False) -> None: if imgui.button("-" if is_expanded else "+"): app._persona_pref_models_expanded[i] = not is_expanded imgui.same_line(); imgui.text(f"{i+1}."); imgui.same_line(); imgui.text_colored(C_LBL(), f"{prov}"); imgui.same_line(); imgui.text("-"); imgui.same_line(); imgui.text_colored(C_IN(), f"{mod}") if not is_expanded: - imgui.same_line(); summary = f" (T:{entry.get('temperature', 0.7):.1f}, P:{entry.get('top_p', 1.0):.2f}, M:{entry.get('max_output_tokens', 0)})" + from src.type_aliases import DiscussionSettings as _DS + ds = _DS.from_dict(entry) if isinstance(entry, dict) else entry + imgui.same_line(); summary = f" (T:{ds.temperature:.1f}, P:{ds.top_p:.2f}, M:{ds.max_output_tokens})" imgui.text_colored(C_SUB(), summary) imgui.same_line(imgui.get_content_region_avail().x - 30); if imgui.button("x"): to_remove.append(i)