Enable live OpenRouter chat (location-aware news context)
Summary
Chat currently runs in deterministic mock mode unless OPENROUTER_API_KEY is set and LLM_MOCK=false. We want chat to reliably use the user-selected location, fetch relevant news for that location, and produce live AI responses when configured.
Expected user behavior
- User selects a location (e.g., “Chattogram”).
- UI immediately shows a status like: Fetching news for Chattogram….
- Backend performs place-scoped ingest (without mutating watchlist) and updates events for that area.
- User sends a chat message (e.g., “Brief this place”).
- AI reply uses the selected place’s context/events/incidents.
- When live mode is active, the API response should indicate it is not mock (e.g., mock: false / no llm: mock).
Required configuration (keep secrets out of git)
- Set OPENROUTER_API_KEY in the local .env (do not commit).
- Set LLM_MOCK=false.
- Set INGEST_MOCK=false when verifying live ingest.
Safety
- Never present sample OSINT rows as official police reports.
- Do not leak secrets or stack traces in errors or logs.
Acceptance criteria
- With OPENROUTER_API_KEY set and LLM_MOCK=false, POST /api/chat returns a live response (not mock).
- Selecting a place triggers place-scoped ingest and chat uses the selected location.
- If ingest yields zero relevant events, chat returns a “no news found / limited context” caveat (not silent success).
- Stale selections cannot overwrite newer ones (sequence/token guard).
Manual test (after enabling live mode)
- Put OPENROUTER_API_KEY=... in .env.
- Set LLM_MOCK=false and INGEST_MOCK=false.
- Start: .
Enable live OpenRouter chat (location-aware news context)
Summary
Chat currently runs in deterministic mock mode unless OPENROUTER_API_KEY is set and LLM_MOCK=false. We want chat to reliably use the user-selected location, fetch relevant news for that location, and produce live AI responses when configured.
Expected user behavior
Required configuration (keep secrets out of git)
Safety
Acceptance criteria
Manual test (after enabling live mode)