Fix: CORS + relative URL + Langfuse tracing wired into gateway

Three fixes:
1. CORS headers on all gateway responses (browser dashboard was
   blocked by same-origin policy)
2. Dashboard JS uses window.location.origin instead of hardcoded
   localhost:3700 (LAN browsers couldn't reach it)
3. Langfuse tracing wired into every gateway request — api() wrapper
   creates spans for each lakehouse call, logGeneration for LLM calls.
   Week simulation now produces 34 observations per run visible in
   Langfuse UI.

7 traces confirmed in Langfuse after restart. Every /sql, /search,
/vram, /simulation call is tracked with timing + inputs + outputs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
root
2026-04-17 00:53:18 -05:00
co-authored by Claude Opus 4.6
parent 4a2bfce6e0
commit cd1fda3e21
2 changed files with 56 additions and 5 deletions
+2 -1
View File
@@ -1,4 +1,5 @@
const GW = "http://localhost:3700";
// Use the same host the browser loaded the page from — works on LAN + localhost
const GW = window.location.origin;
let simData: any = null;
let currentDay = 0;