feat(ui): Support multiple concurrent AI response streams and strategy visualization
This commit is contained in:
37
gui_2.py
37
gui_2.py
@@ -338,6 +338,7 @@ class App:
|
||||
|
||||
# MMA Tracks
|
||||
self.tracks: list[dict] = []
|
||||
self.mma_streams: dict[str, str] = {}
|
||||
|
||||
# Prior session log viewing
|
||||
self.is_viewing_prior_session = False
|
||||
@@ -971,10 +972,20 @@ class App:
|
||||
|
||||
elif action == "handle_ai_response":
|
||||
payload = task.get("payload", {})
|
||||
self.ai_response = payload.get("text", "")
|
||||
self.ai_status = payload.get("status", "done")
|
||||
text = payload.get("text", "")
|
||||
stream_id = payload.get("stream_id")
|
||||
|
||||
if stream_id:
|
||||
self.mma_streams[stream_id] = text
|
||||
if stream_id == "Tier 1":
|
||||
if "status" in payload:
|
||||
self.ai_status = payload["status"]
|
||||
else:
|
||||
self.ai_response = text
|
||||
self.ai_status = payload.get("status", "done")
|
||||
|
||||
self._trigger_blink = True
|
||||
if self.ui_auto_add_history:
|
||||
if self.ui_auto_add_history and not stream_id:
|
||||
role = payload.get("role", "AI")
|
||||
with self._pending_history_adds_lock:
|
||||
self._pending_history_adds.append({
|
||||
@@ -2156,11 +2167,18 @@ class App:
|
||||
tracks = orchestrator_pm.generate_tracks(self.ui_epic_input, flat, file_items, history_summary=history)
|
||||
|
||||
with self._pending_gui_tasks_lock:
|
||||
self._pending_gui_tasks.append({
|
||||
"action": "handle_ai_response",
|
||||
"payload": {
|
||||
"text": json.dumps(tracks, indent=2),
|
||||
"stream_id": "Tier 1",
|
||||
"status": "Epic tracks generated."
|
||||
}
|
||||
})
|
||||
self._pending_gui_tasks.append({
|
||||
"action": "show_track_proposal",
|
||||
"payload": tracks
|
||||
})
|
||||
self.ai_status = "Epic tracks generated."
|
||||
except Exception as e:
|
||||
self.ai_status = f"Epic plan error: {e}"
|
||||
print(f"ERROR in _cb_plan_epic background task: {e}")
|
||||
@@ -2871,6 +2889,11 @@ class App:
|
||||
|
||||
imgui.separator()
|
||||
|
||||
imgui.separator()
|
||||
imgui.text("Strategy (Tier 1)")
|
||||
strategy_text = self.mma_streams.get("Tier 1", "")
|
||||
imgui.input_text_multiline("##mma_strategy", strategy_text, imgui.ImVec2(-1, 150), imgui.InputTextFlags_.read_only)
|
||||
|
||||
# 4. Task DAG Visualizer
|
||||
imgui.text("Task DAG")
|
||||
if self.active_track:
|
||||
@@ -2935,6 +2958,12 @@ class App:
|
||||
deps = ticket.get('depends_on', [])
|
||||
if deps:
|
||||
imgui.text_colored(C_LBL, f"Depends on: {', '.join(deps)}")
|
||||
|
||||
stream_key = f"Tier 3: {tid}"
|
||||
if stream_key in self.mma_streams:
|
||||
imgui.separator()
|
||||
imgui.text_colored(C_KEY, "Worker Stream:")
|
||||
imgui.text_wrapped(self.mma_streams[stream_key])
|
||||
imgui.end_tooltip()
|
||||
|
||||
imgui.same_line()
|
||||
|
||||
Reference in New Issue
Block a user