feat(gui): Add _render_thinking_trace helper and integrate into Discussion Hub
This commit is contained in:
@@ -16,10 +16,9 @@
|
||||
- [x] Task: Write Tests: Verify GUI rendering logic handles thinking segments.
|
||||
- [ ] Task: Implement: Create `_render_thinking_trace` helper in `src/gui_2.py`.
|
||||
- [ ] Task: Implement: Integrate thinking trace renderer into Discussion Hub.
|
||||
## Phase 3: GUI Rendering - Comms & Discussion
|
||||
- [x] Task: Write Tests: Verify GUI rendering logic handles thinking segments.
|
||||
- [x] Task: Implement: Create `_render_thinking_trace` helper in `src/gui_2.py`.
|
||||
- [x] Task: Implement: Integrate thinking trace renderer into Discussion Hub.
|
||||
- [ ] Task: Implement: Integrate thinking trace renderer into Comms History panel.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 3' (Protocol in workflow.md)
|
||||
|
||||
## Phase 4: Final Polish & Theming
|
||||
- [ ] Task: Apply specialized styling to thinking traces.
|
||||
- [ ] Task: Add "Calculating..." indicator while agent is active.
|
||||
- [ ] Task: Conductor - User Manual Verification 'Phase 4' (Protocol in workflow.md)
|
||||
|
||||
26
src/gui_2.py
26
src/gui_2.py
@@ -317,11 +317,28 @@ class App:
|
||||
markdown_helper.render_code(content, context_id=ctx_id)
|
||||
|
||||
if is_nerv: imgui.pop_style_color()
|
||||
# ---------------------------------------------------------------- gui
|
||||
if is_nerv: imgui.pop_style_color()
|
||||
|
||||
def _render_thinking_trace(self, segments: list[dict], entry_index: int) -> None:
|
||||
if not segments:
|
||||
return
|
||||
imgui.indent()
|
||||
header_id = f"thinking_header_{entry_index}"
|
||||
if imgui.collapsing_header(f"Thinking ({len(segments)} traces)", header_id):
|
||||
imgui.begin_child(f"thinking_content_{entry_index}", imgui.ImVec2(0, 80), True)
|
||||
for idx, seg in enumerate(segments):
|
||||
content = seg.get("content", "")
|
||||
marker = seg.get("marker", "thinking")
|
||||
imgui.push_id(f"think_{entry_index}_{idx}")
|
||||
imgui.text_colored(vec4(180, 180, 100), f"[{marker}]")
|
||||
imgui.same_line()
|
||||
imgui.textWrapped(content)
|
||||
imgui.pop_id()
|
||||
imgui.separator()
|
||||
imgui.end_child()
|
||||
imgui.unindent()
|
||||
|
||||
def _render_selectable_label(self, label: str, value: str, width: float = 0.0, multiline: bool = False, height: float = 0.0, color: Optional[imgui.ImVec4] = None) -> None:
|
||||
imgui.push_id(label + str(hash(value)))
|
||||
pops = 4
|
||||
imgui.push_style_color(imgui.Col_.frame_bg, vec4(0, 0, 0, 0))
|
||||
imgui.push_style_color(imgui.Col_.frame_bg_hovered, vec4(0, 0, 0, 0))
|
||||
@@ -2297,10 +2314,11 @@ def hello():
|
||||
imgui.end_child()
|
||||
else:
|
||||
ch, entry["content"] = imgui.input_text_multiline("##content", entry["content"], imgui.ImVec2(-1, 150))
|
||||
thinking_segments = entry.get("thinking_segments", [])
|
||||
if thinking_segments:
|
||||
self._render_thinking_trace(thinking_segments, i)
|
||||
imgui.separator()
|
||||
imgui.pop_id()
|
||||
if self._scroll_disc_to_bottom:
|
||||
imgui.set_scroll_here_y(1.0)
|
||||
self._scroll_disc_to_bottom = False
|
||||
imgui.end_child()
|
||||
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
import pytest
|
||||
|
||||
|
||||
def test_render_thinking_trace_helper_exists():
|
||||
from src.gui_2 import App
|
||||
|
||||
assert hasattr(App, "_render_thinking_trace"), (
|
||||
"_render_thinking_trace helper should exist in App class"
|
||||
)
|
||||
|
||||
|
||||
def test_discussion_entry_with_thinking_segments():
|
||||
entry = {
|
||||
"role": "AI",
|
||||
@@ -38,6 +46,7 @@ def test_thinking_segment_model_compatibility():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_render_thinking_trace_helper_exists()
|
||||
test_discussion_entry_with_thinking_segments()
|
||||
test_discussion_entry_without_thinking()
|
||||
test_thinking_segment_model_compatibility()
|
||||
|
||||
Reference in New Issue
Block a user