Private
Public Access
0
0

fix(gui): Restore discussion tinting and fix Markdown table width

- Implement layered tinting using draw_list channels in modular discussion renderer.
- Fix vertical squashing of Markdown tables by forcing full group width with a dummy.
- Consolidate color constants into src/ui_shared.py to prevent circular imports.
- Update src/theme_2.py with role-based tint helpers.
- Successfully verified imports and layout logic.
This commit is contained in:
2026-06-02 10:44:45 -04:00
parent 07017e2dd2
commit 46f22f0df9
4 changed files with 106 additions and 71 deletions
+1 -46
View File
@@ -72,20 +72,7 @@ def hide_tk_root() -> Tk:
root.wm_attributes("-topmost", True)
return root
def vec4(r: float, g: float, b: float, a: float = 1.0) -> imgui.ImVec4: return imgui.ImVec4(r/255, g/255, b/255, a)
C_OUT: imgui.ImVec4 = vec4(100, 200, 255)
C_IN: imgui.ImVec4 = vec4(140, 255, 160)
C_REQ: imgui.ImVec4 = vec4(255, 220, 100)
C_RES: imgui.ImVec4 = vec4(180, 255, 180)
C_TC: imgui.ImVec4 = vec4(255, 180, 80)
C_TR: imgui.ImVec4 = vec4(180, 220, 255)
C_TRS: imgui.ImVec4 = vec4(200, 180, 255)
C_LBL: imgui.ImVec4 = vec4(180, 180, 180)
C_VAL: imgui.ImVec4 = vec4(220, 220, 220)
C_KEY: imgui.ImVec4 = vec4(140, 200, 255)
C_NUM: imgui.ImVec4 = vec4(180, 255, 180)
C_SUB: imgui.ImVec4 = vec4(220, 200, 120)
from src.ui_shared import vec4, C_OUT, C_IN, C_REQ, C_RES, C_TC, C_TR, C_TRS, C_LBL, C_VAL, C_KEY, C_NUM, C_SUB
DIR_COLORS: dict[str, imgui.ImVec4] = {"OUT": C_OUT, "IN": C_IN}
KIND_COLORS: dict[str, imgui.ImVec4] = {"request": C_REQ, "response": C_RES, "tool_call": C_TC, "tool_result": C_TR, "tool_result_send": C_TRS}
@@ -4264,38 +4251,6 @@ def render_heavy_text(app: App, label: str, content: str, id_suffix: str = "") -
imgui.text(content)
imgui.end_child()
def render_thinking_trace(app: App, entry: dict, segments: list[dict], entry_index: int, is_standalone: bool = False) -> None:
if not segments:
return
with imscope.style_color(imgui.Col_.child_bg, vec4(40, 35, 25, 180)), \
theme.ai_text_style():
with imscope.indent():
show_content = True
if not is_standalone:
header_label = f"Monologue ({len(segments)} traces)###thinking_header_{entry_index}"
show_content = imgui.collapsing_header(header_label)
if show_content:
thinking_read_mode = entry.get("thinking_read_mode", True)
if imgui.button(f"[Pure]##think_pure_{entry_index}" if thinking_read_mode else f"[Read]##think_read_{entry_index}"):
entry["thinking_read_mode"] = not thinking_read_mode
imgui.same_line()
imgui.text_colored(vec4(180, 150, 80), "Selectable toggle")
h = 150 if is_standalone else 100
with imscope.child(f"thinking_content_{entry_index}", 0, h, True):
for idx, seg in enumerate(segments):
content = seg.get("content", "")
marker = seg.get("marker", "thinking")
with imscope.id(f"think_{entry_index}_{idx}"):
imgui.text_colored(vec4(180, 150, 80), f"[{marker}]")
if thinking_read_mode:
if app.ui_word_wrap:
with imscope.text_wrap(imgui.get_content_region_avail().x):
imgui.text(content)
else:
imgui.text(content)
else:
render_selectable_label(app, f"think_text_{entry_index}_{idx}", content, multiline=True, height=-1)
imgui.separator()
def render_selectable_label(app: App, label: str, value: str, width: float = 0.0, multiline: bool = False, height: float = 0.0, color: Optional[imgui.ImVec4] = None) -> None:
with imscope.id(label + str(hash(value))):