- Phase 1: Vietnamese Mock Data Vendor —
mock_data.pywith VCB/VNM/FPT/TPB mock OHLCV, fundamentals, news;interface.pyinterception inroute_to_vendor() - Phase 2: Pydantic Models & User Profiles —
models.py(UserProfile, ChatRequest, ChatResponse, HeartbeatAlert, MarketTicker);profiles.pyin-memory store - Phase 3: Expanded API Endpoints — CORS, error handling,
/api/chat,/api/chat/voice,/api/onboarding,/api/market-data,/api/user/{id}/profile,/api/user/{id}/chat-history,/api/heartbeat/alerts,/api/heartbeat/trigger - Phase 4: HEARTBEAT Alert System —
heartbeat.pywith 8 pre-built scenarios, per-user queues, demo seeding on startup - Phase 5: Voice TTS —
voice.pyusing httpx + ElevenLabs API, graceful fallback if no key - Phase 6: Prompt Tuning — All 4 analyst prompts: conciseness (3-5 bullets, 200 words) + Vietnamese context (HOSE, VND, SBV)
- Phase 7: Railway Deployment —
Dockerfile+railway.toml
- Smoke test all endpoints locally — start server, hit
/healthz,/api/chat,/api/market-data,/api/heartbeat/alerts - Deploy to Railway — push, verify healthcheck, test
/api/chatremotely - Test VN mock data path — confirm
curl POST /api/chat -d '{"message":"Should I buy VCB?"}'returns mock-sourced ChatResponse - Test US ticker fallback — confirm AAPL/MSFT still use live yfinance via
/v1/chat/completions - Validate mobile API contract — ensure
/api/chatresponse shape matches what the mobile team expects (ChatResponse schema)
- Background auto-alerts — background task that triggers random heartbeat alerts every 60s during demo
- WebSocket alerts — upgrade heartbeat from polling to WebSocket push for real-time mobile UX
- Chat history persistence — replace in-memory dict with SQLite or Redis for persistence across restarts
- User profile enrichment — add
preferred_tickersto onboarding flow, use in default ticker selection - Streaming
/api/chat— add SSE streaming option to the simplified chat endpoint (currently only/v1/chat/completionsstreams)
- Real Vietnamese data vendor — integrate SSI, VNDirect, or CafeF API for live HOSE data
- Multi-language TTS — Vietnamese voice output via ElevenLabs multilingual model
- Auth & rate limiting — API key auth, per-user rate limits
- Portfolio tracking — persistent portfolio with P&L tracking, linked to heartbeat alerts
- Agent memory — cross-session user preference learning (risk tolerance evolution, ticker affinity)
- ElevenLabs API key is optional — voice endpoint gracefully falls back to JSON
- Mock data uses deterministic random seeds (seeded on ticker name) so prices are consistent within a day
_extract_specialist_insights()maps internal LangGraph state keys to user-friendly roles- HEARTBEAT
get_pending_alerts()returns-and-clears — alerts are consumed on poll