Skip to content

feat: React UI + FastAPI backend — full Streamlit→React migration#200

Merged
kuivi merged 11 commits intomainfrom
react_ui
Mar 5, 2026
Merged

feat: React UI + FastAPI backend — full Streamlit→React migration#200
kuivi merged 11 commits intomainfrom
react_ui

Conversation

@dmpantiu
Copy link
Collaborator

@dmpantiu dmpantiu commented Mar 5, 2026

Summary

Complete migration from Streamlit-only architecture to React (Vite/TypeScript) frontend + FastAPI backend, while preserving the legacy Streamlit UI.

What's new

React Frontend (~20 new files)

  • Vite + React + TypeScript app in frontend/
  • Components: MapPanel, QueryForm, ReportView, SettingsPanel, StatusBar
  • Premium scientific UI with dark theme, glassmorphism, and smooth animations
  • WebSocket-based streaming for real-time agent progress
  • Markdown report rendering with embedded plots and download support

FastAPI Backend (5 new files)

  • api/main.py — app factory, CORS, static file serving
  • api/routes/analysis.py — REST + WebSocket endpoints for climate analysis
  • api/routes/sessions.py — per-session state management
  • run.py — unified launcher
  • requirements-api.txt — backend dependencies

Core engine decoupling (17 modified files)

  • Removed all import streamlit as st from core modules (climate_functions, environmental_functions, geo_functions, etc.)
  • Replaced st.session_stateos.environ for thread IDs, API keys, and dataset text
  • Replaced st.secretsos.environ for API key resolution
  • Simplified StreamHandler error handling (removed Streamlit-specific NoSessionContext checks)
  • Added retry logic to ERA5 retrieval tool (1 retry after 10s) + proper client.close()
  • New session_manager.py for per-session state and memory isolation

Docs

  • README.md fully rewritten for the new architecture (FastAPI + React + legacy Streamlit instructions)

Deleted

  • DATA_ANALYSIS_AGENT_PROMPT.md (prompt now lives inline)
  • PULL_REQUEST.md (obsolete)

Stats

  • 48 files changed, +9,566 / −1,019 lines
  • 29 new files, 17 modified, 2 deleted

- Add API key inputs, DestinE token badge to SettingsPanel
- Add env-status endpoint to sessions.py
- Add Data tab with dataset downloads, categorized Figures tab
- Add PDF/TXT download buttons to Report tab
- Fix: AsyncWsHandler inherits StreamHandler for real-time streaming
- Fix: path traversal protection (pathlib resolve + is_relative_to)
- Fix: OOM Zarr zip → FileResponse + tempfile + BackgroundTask
- Fix: dataset downloads search full sandbox, not just results_dir
- Fix: remove os.environ thread-safety issue (CLIMSIGHT_THREAD_ID)
- Fix: correct API routes in client.ts (/api/models, /api/climate-sources)
- Fix: plots only in Figures tab, not duplicated in Report
- Fix: Settings panel overflow scroll

6 files changed, +495/-50
…in (PR #199)

- Complete CSS redesign: ultra-minimal scientific aesthetic
- Scrollable tables with sticky headers (max 45vh)
- Proper markdown rendering: bullet points, nested lists, headings
- Download PDF → Download Markdown (.md format)
- run.py auto-loads .env via python-dotenv
- Remove Tailwind utility classes from App.tsx
- Increase font sizes across all UI components
- Merge origin/main into react_ui (parallel downloads, improved prompts)
- Add clean_sandbox() to sandbox_utils.py — wipes results/, climate_data/,
  era5_data/, destine_data/ at the start of each analysis
- Call clean_sandbox() in all 3 entry points: API, Streamlit, CLI
- Fix broken ensure_thread_id(session_state=...) call in streamlit_interface.py
@kuivi kuivi self-requested a review March 5, 2026 19:08
@kuivi kuivi merged commit 99dafa0 into main Mar 5, 2026
4 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.

2 participants