conductor(track): Complete gui2_feature_parity track
Close gui2_feature_parity track after implementing all features and conducting manual and automated verification. Key Achievements: - Integrated event-driven architecture and MCP client. - Ported API hooks and performance diagnostics. - Implemented Prior Session Viewer. - Refactored UI to a Hub-based layout. - Added agent capability toggles. - Achieved full theme integration. - Developed comprehensive test suite. Note: Remaining UI display issues for text panels in the comms and tool call history will be addressed in a subsequent track.
This commit is contained in:
102
gui_2.py
102
gui_2.py
@@ -100,7 +100,7 @@ class App:
|
||||
|
||||
ai_cfg = self.config.get("ai", {})
|
||||
self.current_provider: str = ai_cfg.get("provider", "gemini")
|
||||
self.current_model: str = ai_cfg.get("model", "gemini-2.0-flash")
|
||||
self.current_model: str = ai_cfg.get("model", "gemini-2.5-flash")
|
||||
self.available_models: list[str] = []
|
||||
self.temperature: float = ai_cfg.get("temperature", 0.0)
|
||||
self.max_tokens: int = ai_cfg.get("max_tokens", 8192)
|
||||
@@ -574,14 +574,20 @@ class App:
|
||||
def _render_heavy_text(self, label: str, content: str):
|
||||
imgui.text_colored(C_LBL, f"{label}:")
|
||||
imgui.same_line()
|
||||
self._render_text_viewer(label, content)
|
||||
if imgui.button("[+]##" + label):
|
||||
self.show_text_viewer = True
|
||||
self.text_viewer_title = label
|
||||
self.text_viewer_content = content
|
||||
|
||||
if len(content) > COMMS_CLAMP_CHARS:
|
||||
if self.ui_word_wrap:
|
||||
imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
|
||||
imgui.text(content)
|
||||
imgui.pop_text_wrap_pos()
|
||||
else:
|
||||
imgui.input_text_multiline(f"##{id(content)}", content, imgui.ImVec2(-1, 80), imgui.InputTextFlags_.read_only)
|
||||
if imgui.begin_child(f"heavy_text_child_{label}", imgui.ImVec2(0, 80), True):
|
||||
imgui.input_text_multiline(f"##{label}_input", content, imgui.ImVec2(-1, -1), imgui.InputTextFlags_.read_only)
|
||||
imgui.end_child()
|
||||
else:
|
||||
if self.ui_word_wrap:
|
||||
imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
|
||||
@@ -1096,7 +1102,7 @@ class App:
|
||||
payload = entry.get("payload", entry)
|
||||
text = payload.get("text", payload.get("message", payload.get("content", "")))
|
||||
if text:
|
||||
preview = str(text).replace("\n", " ")[:200]
|
||||
preview = str(text).replace("\\n", " ")[:200]
|
||||
if self.ui_word_wrap:
|
||||
imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
|
||||
imgui.text(preview)
|
||||
@@ -1107,6 +1113,7 @@ class App:
|
||||
imgui.pop_id()
|
||||
imgui.end_child()
|
||||
imgui.pop_style_color()
|
||||
return
|
||||
|
||||
if not self.is_viewing_prior_session and imgui.collapsing_header("Discussions", imgui.TreeNodeFlags_.default_open):
|
||||
names = self._get_discussion_names()
|
||||
@@ -1175,12 +1182,6 @@ class App:
|
||||
self._flush_to_config()
|
||||
save_config(self.config)
|
||||
self.ai_status = "discussion saved"
|
||||
imgui.same_line()
|
||||
if imgui.button("Load Log"):
|
||||
self.cb_load_prior_log()
|
||||
imgui.same_line()
|
||||
if imgui.button("Load Log"):
|
||||
self.cb_load_prior_log()
|
||||
|
||||
ch, self.ui_auto_add_history = imgui.checkbox("Auto-add message & response to history", self.ui_auto_add_history)
|
||||
|
||||
@@ -1253,7 +1254,7 @@ class App:
|
||||
imgui.pop_id()
|
||||
break
|
||||
imgui.same_line()
|
||||
preview = entry["content"].replace("\n", " ")[:60]
|
||||
preview = entry["content"].replace("\\n", " ")[:60]
|
||||
if len(entry["content"]) > 60: preview += "..."
|
||||
imgui.text_colored(vec4(160, 160, 150), preview)
|
||||
|
||||
@@ -1455,19 +1456,43 @@ class App:
|
||||
for i, (script, result) in enumerate(self._tool_log, 1):
|
||||
first_line = script.strip().splitlines()[0][:80] if script.strip() else "(empty)"
|
||||
imgui.text_colored(C_KEY, f"Call #{i}: {first_line}")
|
||||
imgui.same_line()
|
||||
self._render_text_viewer(f"Call Script #{i}", script)
|
||||
imgui.same_line()
|
||||
self._render_text_viewer(f"Call Output #{i}", result)
|
||||
|
||||
# Script Display
|
||||
imgui.text_colored(C_LBL, "Script:")
|
||||
imgui.same_line()
|
||||
if imgui.button(f"[+]##script_{i}"):
|
||||
self.show_text_viewer = True
|
||||
self.text_viewer_title = f"Call Script #{i}"
|
||||
self.text_viewer_content = script
|
||||
if self.ui_word_wrap:
|
||||
imgui.begin_child(f"tc_wrap_{i}", imgui.ImVec2(-1, 72), True)
|
||||
imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
|
||||
imgui.text(result)
|
||||
imgui.pop_text_wrap_pos()
|
||||
imgui.end_child()
|
||||
if imgui.begin_child(f"tc_script_wrap_{i}", imgui.ImVec2(-1, 72), True):
|
||||
imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
|
||||
imgui.text(script)
|
||||
imgui.pop_text_wrap_pos()
|
||||
imgui.end_child()
|
||||
else:
|
||||
imgui.input_text_multiline(f"##tc_res_{i}", result, imgui.ImVec2(-1, 72), imgui.InputTextFlags_.read_only)
|
||||
if imgui.begin_child(f"tc_script_fixed_width_{i}", imgui.ImVec2(0, 72), True, imgui.WindowFlags_.horizontal_scrollbar):
|
||||
imgui.input_text_multiline(f"##tc_script_res_{i}", script, imgui.ImVec2(-1, -1), imgui.InputTextFlags_.read_only)
|
||||
imgui.end_child()
|
||||
|
||||
# Result Display
|
||||
imgui.text_colored(C_LBL, "Output:")
|
||||
imgui.same_line()
|
||||
if imgui.button(f"[+]##output_{i}"):
|
||||
self.show_text_viewer = True
|
||||
self.text_viewer_title = f"Call Output #{i}"
|
||||
self.text_viewer_content = result
|
||||
if self.ui_word_wrap:
|
||||
if imgui.begin_child(f"tc_res_wrap_{i}", imgui.ImVec2(-1, 72), True):
|
||||
imgui.push_text_wrap_pos(imgui.get_content_region_avail().x)
|
||||
imgui.text(result)
|
||||
imgui.pop_text_wrap_pos()
|
||||
imgui.end_child()
|
||||
else:
|
||||
if imgui.begin_child(f"tc_res_fixed_width_{i}", imgui.ImVec2(0, 72), True, imgui.WindowFlags_.horizontal_scrollbar):
|
||||
imgui.input_text_multiline(f"##tc_res_val_{i}", result, imgui.ImVec2(-1, -1), imgui.InputTextFlags_.read_only)
|
||||
imgui.end_child()
|
||||
|
||||
imgui.separator()
|
||||
imgui.end_child()
|
||||
|
||||
@@ -1477,6 +1502,19 @@ class App:
|
||||
if imgui.button("Clear##comms"):
|
||||
ai_client.clear_comms_log()
|
||||
self._comms_log.clear()
|
||||
imgui.same_line()
|
||||
if imgui.button("Load Log"):
|
||||
self.cb_load_prior_log()
|
||||
|
||||
if self.is_viewing_prior_session:
|
||||
imgui.same_line()
|
||||
if imgui.button("Exit Prior Session"):
|
||||
self.is_viewing_prior_session = False
|
||||
self.prior_session_entries.clear()
|
||||
self.ai_status = "idle"
|
||||
imgui.separator()
|
||||
imgui.text_colored(vec4(255, 200, 100), "VIEWING PRIOR SESSION")
|
||||
|
||||
imgui.separator()
|
||||
|
||||
imgui.text_colored(C_OUT, "OUT")
|
||||
@@ -1494,23 +1532,30 @@ class App:
|
||||
imgui.text_colored(C_TR, "tool_result")
|
||||
imgui.separator()
|
||||
|
||||
# Use tinted background for prior session
|
||||
if self.is_viewing_prior_session:
|
||||
imgui.push_style_color(imgui.Col_.child_bg, vec4(40, 30, 20))
|
||||
|
||||
imgui.begin_child("comms_scroll", imgui.ImVec2(0, 0), False, imgui.WindowFlags_.horizontal_scrollbar)
|
||||
for idx, entry in enumerate(self._comms_log, 1):
|
||||
|
||||
log_to_render = self.prior_session_entries if self.is_viewing_prior_session else self._comms_log
|
||||
|
||||
for idx, entry in enumerate(log_to_render, 1):
|
||||
imgui.push_id(f"comms_{idx}")
|
||||
d = entry["direction"]
|
||||
k = entry["kind"]
|
||||
d = entry.get("direction", "IN")
|
||||
k = entry.get("kind", "response")
|
||||
|
||||
imgui.text_colored(vec4(160, 160, 160), f"#{idx}")
|
||||
imgui.same_line()
|
||||
imgui.text_colored(vec4(160, 160, 160), entry["ts"])
|
||||
imgui.text_colored(vec4(160, 160, 160), entry.get("ts", "00:00:00"))
|
||||
imgui.same_line()
|
||||
imgui.text_colored(DIR_COLORS.get(d, C_VAL), d)
|
||||
imgui.same_line()
|
||||
imgui.text_colored(KIND_COLORS.get(k, C_VAL), k)
|
||||
imgui.same_line()
|
||||
imgui.text_colored(C_LBL, f"{entry['provider']}/{entry['model']}")
|
||||
imgui.text_colored(C_LBL, f"{entry.get('provider', '?')}/{entry.get('model', '?')}")
|
||||
|
||||
payload = entry["payload"]
|
||||
payload = entry.get("payload", {})
|
||||
|
||||
if k == "request":
|
||||
self._render_heavy_text("message", payload.get("message", ""))
|
||||
@@ -1600,6 +1645,9 @@ class App:
|
||||
imgui.separator()
|
||||
imgui.pop_id()
|
||||
imgui.end_child()
|
||||
|
||||
if self.is_viewing_prior_session:
|
||||
imgui.pop_style_color()
|
||||
|
||||
def _render_system_prompts_panel(self):
|
||||
imgui.text("Global System Prompt (all projects)")
|
||||
|
||||
Reference in New Issue
Block a user