spacr.qt.widgets.ai_chat_panel
AIChatPanel — reusable chat widget hosting the spacr AI Console.
Meant to be embedded next to the pipeline Console (via a QDockWidget on the main window) so users never leave the app they’re running. Exposes open_error_flow(traceback, active_app) for AppScreen’s “Explain error” button.
Design notes
One instance is shared across the whole main window; the user’s chat context persists as they switch between Mask/Measure/etc.
Streaming is done in a QThread via spacr.qt.ai.worker.StreamWorker. The worker reference is stored on self — if we let Python drop it, Qt may never deliver the finished signal.
There is NO “already streaming” guard. If a stream is in flight, the Send button turns into Cancel so the user can always recover.
Module Contents
- class spacr.qt.widgets.ai_chat_panel.AIChatPanel(parent: PySide6.QtWidgets.QWidget | None = None)[source]
Bases:
PySide6.QtWidgets.QWidgetFull chat panel — embed inside a QDockWidget or any container.