7.7 KiB
7.7 KiB
TUI Feeds
This guide explains how the terminal dashboard surfaces collection activity and status signals so new backends can plug in without duplicating UI logic.
Activity Feed
- Primary surface:
#activity_feedwidget insideDashboardScreen(ingest_pipeline/cli/tui/screens/dashboard.py). - Data source:
self.collections, populated byrefresh_collections()after gathering payloads from Weaviate and OpenWebUI viadescribe_collections(). - Selection logic:
_generate_activity_text()formats the three most recentCollectionInfoentries and appends an aggregate line when additional collections exist. - Empty state: Presents the call-to-action “🚀 No collections found…” encouraging the user to launch an ingestion run.
- Icons:
_get_content_type_icon()maps collection names containingweb,doc, orrepoto 🌐/📖/📦 respectively, and falls back to 📄. Update this helper when introducing new naming conventions.
When it refreshes
refresh_collections()loads data for each connected backend and caches it inself.collections._update_activity_feed()is triggered fromupdate_metrics()immediately after metrics cards recompute.- The Static widget updates with a newline-delimited summary, keeping the dashboard reactive without rerendering the entire layout.
To surface a new backend, extend either list_weaviate_collections() or list_openwebui_collections() with the additional source (or introduce a new list helper) and ensure the resulting dictionaries match the CollectionInfo contract.
Status Ticker
- Widget:
#status_textStatic component under the metrics card cluster. - Lifecycle:
refresh_collections()pushes human-readable messages as each backend initializes, succeeds, or fails, ending with a ready state. - Problem reporting: Failures bubble into rich notifications via
self.notifyand remain visible in the ticker until the next refresh attempt. - System health badge:
_update_status_card()converts backend counts into 🟢/🟡/🔴 badges so operators can judge connectivity at a glance.
When adding a backend integration, hook into the progress text updates inside refresh_collections() so the ticker narrates each stage consistently.
Notifications & Progress
- Toast notifications: All feed-relevant exceptions use
self.notifywith severity hints, keeping the activity feed focused on successful runs. - Ingestion progress:
IngestionScreen.perform_ingestion()(same module) drives the animated progress bar and sends celebratory/failure messages that complement the dashboard feed once control returns to the main screen.
Extending the Feed System
- Return a fully populated
CollectionInfo(name, type, backend label, status, last_updated, size_mb, count). - Call
update_metrics()after mutatingself.collectionsso both metrics cards and the activity feed stay in sync. - Adjust
_get_content_type_icon()or_format_collection_item()if the new source warrants distinct labeling. - Update end-to-end tests or manual runbooks to verify the ticker, notifications, and activity feed stay coherent after integration.
Implementation Status (September 17, 2025)
| Component | Responsibility | Location |
|---|---|---|
| Activity feed rendering | _update_activity_feed, _generate_activity_text, _format_collection_item |
ingest_pipeline/cli/tui/screens/dashboard.py |
| Backend loaders | list_weaviate_collections, list_openwebui_collections |
ingest_pipeline/cli/tui/screens/dashboard.py |
| Status ticker & health badge | _update_status_card, refresh_collections progress updates |
ingest_pipeline/cli/tui/screens/dashboard.py |
| Ingestion progress hand-off | perform_ingestion success/error notifications |
ingest_pipeline/cli/tui/screens/ingestion.py |
Multi-Storage Ingestion Refactor Plan
0. Guardrails and Baseline
- Activate the virtual environment (
source .venv/bin/activate) before running any tooling. - Capture current lint, type, and test status (
uv run basedpyright,uv run ruff check,uv run pytest) to compare after the refactor. - Record the existing ingestion modal behaviour (screenshots or a short
textual run --dev ingest_pipeline/cli/tuidemo) to verify UX parity later.
1. Storage Layer Enhancements
- Graduate
MultiStorageAdapterintoingest_pipeline/storage/so it can be reused outside the TUI package. - Extend
BaseStoragewith a descriptivedisplay_nameproperty that downstream UIs can show without hard-coding labels. - Harden the adapter: aggregate per-backend failures, short-circuit
close()safely, and surface a structured result containingsuccess_idsandfailed_targets. - Add
StorageManager.build_multi_adapter(backends: Sequence[StorageBackend])that returns an initialised adapter (invokesinitialize()on each child) and memoises singletons for reuse inside the session.
2. Application Wiring
- Refactor
CollectionManagementAppto accept aStorageManagerplus optional cached clients, removing direct constructor parameters for Weaviate/OpenWebUI. - Update all screens (
dashboard.py,documents.py,search.py, dialogs) to pull storages through the shared manager instead of owning bespoke references. - Expose a capability flag (e.g.,
StorageCapabilities.REPLICATION) so the dashboard can badge backends that support multi-target ingestion.
3. Ingestion Modal UX
- Replace the single-backend select with a checkbox group generated from
StorageManager.get_available_backends(); preserve keyboard shortcuts (1,2,3, plusctrl+shift+<n>for toggling if feasible). - Default the selection to the collection’s current backend but allow "Select All"/"Clear" convenience buttons.
- Persist the latest selection inside a lightweight config file (for example
~/.config/rag-manager/tui.json) to improve repeated runs.
4. Flow Integration
- Update
IngestionScreen.perform_ingestion()to build the multi-adapter, pass it toingest_documents_task, and capture per-backend success/failure counts for feed reporting. - Teach
ingest_pipeline/flows/ingestion.pyhelpers to recognise the adapter (inspect forfanout_targets) and log progress per backend, while keeping Firecrawl→R2R flow single-target until replication lands there. - Ensure partial failures propagate as
IngestionStatus.PARTIALwith an error message enumerating the failing targets.
5. Feeds, Ticker, and Notifications
- Extend
_generate_activity_text()to append the backend list (e.g.,→ weaviate + open_webui) when a multi-target run finishes. - Add per-backend status lines to the progress ticker so operators know which replication stage is executing.
- Emit granular toast notifications: success summary plus warning toasts for any backend that failed to store documents.
6. Validation
- Add unit coverage for
MultiStorageAdapter(full success, partial failure, close semantics) underingest_pipeline/tests/storage/. - Create a focused TUI smoke test that opens the ingestion modal, toggles multiple checkboxes, and asserts the resulting progress copy.
- Re-run
uv run basedpyright,uv run ruff check, and the targeted pytest suite before and after changes; address new diagnostics immediately. - Optionally script a headless
textual runthat simulates ingestion across two mock storages to guard against regressions.
7. Documentation and Rollout
- Update this document and
README.mdwith refreshed screenshots/GIFs demonstrating multi-backend ingestion. - Draft release notes covering required configuration (API keys for every backend) and outline rollback instructions (git tag + revert steps).
- Brief support/playbook owners on interpreting the enriched feed/ticker signals so incidents can be triaged quickly.