diff --git a/src/gui_2.py b/src/gui_2.py index 0a23584b..2ddbe5c7 100644 --- a/src/gui_2.py +++ b/src/gui_2.py @@ -4035,6 +4035,36 @@ def render_thinking_trace(app: App, entry: dict, segments: list[dict], entry_ind imgui.separator() def render_discussion_entry(app: App, entry: dict, index: int) -> None: + """ + Renders a single discussion message entry as a colored visual bubble. + Supports collapsible states, read/edit mode toggles, role selection, + input/output token metrics, and action footers. + + State Mutations: + app.disc_entries[index]['collapsed'] (toggled by header button) + app.disc_entries[index]['read_mode'] (toggled by header button) + app.disc_entries[index]['role'] (changed by combo selection) + + DAG Render Context: + Called by: _render_discussion_hub() / render_discussion_hub() + Calls: render_discussion_entry_read_mode(), thinking_parser.parse() + + ASCII Layout Preview: + +-------------------------------------------------------------+ + | [-] Entry #3 [Role: AI v] [Read] @2026-06-12 in:12 | + +-------------------------------------------------------------+ + | | + | [thinking trace: ] | + | | + | "I think the right approach is..." | + | | + +-------------------------------------------------------------+ + | [Ins] [Del] [Branch] | + +-------------------------------------------------------------+ + + Threading & Safety: + Must run synchronously on the Main Thread. + """ with imscope.id(f"disc_{index}"): role = entry.get("role", "User") bg_col = theme.get_role_tint(role) @@ -4504,6 +4534,29 @@ def render_discussion_entries(app: App) -> None: if app._scroll_disc_to_bottom: imgui.set_scroll_here_y(1.0); app._scroll_disc_to_bottom = False def render_discussion_entry_controls(app: App) -> None: + """ + Renders the action buttons at the bottom of the discussion panel. + Handles adding entries, expanding/collapsing all bubbles, clearing, saving, + compressing logs, and configuring auto-history checkpoints. + + State Mutations: + app.disc_entries (adds, collapses, clears elements) + app.ui_auto_add_history (toggled via checkbox) + app.ai_status (updated upon saving) + + DAG Render Context: + Called by: render_discussion_hub() + Calls: AppController._handle_compress_discussion(), App._flush_to_project() + + ASCII Layout Preview: + +-------------------------------------------------------------+ + | [+ Entry] [-All] [+All] [Clear All] [Save] [Compress] | + | [x] Auto-add message & response to history | + +-------------------------------------------------------------+ + + Threading & Safety: + Must run synchronously on the Main Thread. + """ if imgui.button("+ Entry"): app.disc_entries.append({"role": app.disc_roles[0] if app.disc_roles else "User", "content": "", "collapsed": True, "ts": project_manager.now_ts()}) imgui.same_line() if imgui.button("-All"):