Skip to content

Phase 1: UI Restructuring + Batch Ontology Review - #107

Merged
fbaierl merged 13 commits into
mainfrom
feature/map-and-ontology
Apr 29, 2026
Merged

Phase 1: UI Restructuring + Batch Ontology Review#107
fbaierl merged 13 commits into
mainfrom
feature/map-and-ontology

Conversation

@fbaierl

@fbaierl fbaierl commented Apr 27, 2026

Copy link
Copy Markdown
Owner

Summary

Implements Phase 1 of the Intelligence Pipeline restructuring (#102, #103).

Backend Changes

  • Deferred Merge Flow: now saves extracted changes as in session state instead of merging directly to Neo4j
  • New API Endpoints:
      • Get pending changes
      • Approve selected/all changes → merge to Neo4j
      • Reject selected/all changes → discard
      • Manual trigger: extract from full conversation
      • List ingested documents for Sources tab
  • SSE Events: Added event for real-time pending updates

Frontend Changes

  • Three-Tab Layout: Reorganized UI into User, Sources, and Ontology tabs
    • User Tab: Chat interface, session list, query history
    • Sources Tab: Ingested documents list, tool usage summary
    • Ontology Tab: Knowledge graph, JSON tree, table, cards + pending review panel
  • Pipeline Status Bar: Shows status of User/Sources/Ontology pipeline stages with pending indicator
  • Pending Review Panel: Displays pending entities/links with checkboxes, approve/reject actions (selected or all)

Backward Compatibility

  • Existing sessions with merged ontologies continue to work unchanged
  • New sessions use the pending flow
  • Legacy floating window mode available via "Desktop Mode" toggle
  • All existing API endpoints remain functional

Implementation Tasks

  • Add to session state schema
  • Modify to output pending instead of merging
  • Add endpoint
  • Add endpoint
  • Add endpoint
  • Add endpoint
  • Add API endpoint: list ingested documents
  • Restructure UI into three-tab layout
  • Add pending review panel to Ontology tab
  • Add pipeline status bar
  • Wire up pending ontology API calls

Related

fbaierl added 13 commits April 26, 2026 18:48
- Add pending_ontology to AgentState for deferred merge flow
- Modify ontology subgraph to save as pending instead of merging to Neo4j
- Add API endpoints: GET/POST pending-ontology, approve, reject, build
- Add documents listing endpoint for Sources tab
- Restructure UI into three-tab layout (User, Sources, Ontology)
- Add pipeline status bar showing session/sources/ontology status
- Add pending review panel with approve/reject functionality
- Wire up pending_ontology_updated SSE event to frontend
- Fix pending ontology bug: filter out already-committed entities/links
  by comparing against Neo4j ontology before adding to pending
- Sources tab now shows intelligence log with chat replies + tool results
  from each query (expandable entries with response snippets and tool badges)
- Add collapsible reasoning trail below chat area in User tab
  (auto-expands on query, shows step count badge)
- Add service links grid to Sources tab (Terminal, Dozzle, Grafana,
  MongoDB, Neo4j, LangSmith)
- Improve pending review UI:
  - Color-coded entity type badges (Person, Location, Organization, etc.)
  - Select-all checkboxes per section
  - Source text snippets for each pending entity
  - Loading spinners on approve/reject buttons
  - Success/error status messages after actions
  - Empty state when no pending changes
  - Disabled selected buttons when nothing is selected
- main-tabs.js: filter out tools without .name before toLowerCase(),
  preventing TypeError on undefined entries in sourceLog
- pending-ontology.js: after approve, fetch full ontology from
  GET /api/ontology/{threadId} and call updateOntology() instead of
  nonexistent loadOntology()
- Wire Sources tab refresh button to call _renderSources()
- ontology_extractor.py: Replace fragile markdown fence stripping with
  robust _extract_json_from_response() that handles prose before JSON,
  code fences anywhere in the response, and brace extraction fallback
- streaming.py: Include pending_ontology in auto-save to MongoDB so
  it survives page refresh/restart (was only saving messages before)
- sessions.py: Accept pending_ontology in SessionSave model, persist
  it on both insert and update operations
- graph.py: Fix link filter to keep links between pending and committed
  entities (was dropping any link whose endpoint wasn't also pending)
- graph.py: Add update_graph_pending_ontology() to sync LangGraph
  checkpointer state after approve/reject (prevents stale pending data)
- sessions.py: Call update_graph_pending_ontology after approve and
  reject to keep graph state and MongoDB consistent
@fbaierl
fbaierl merged commit 15822d1 into main Apr 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Phase 1: UI Restructuring + Batch Ontology Review

1 participant