From 5d543df36a237fe9e59382b605eb4af7d6c4b052 Mon Sep 17 00:00:00 2001 From: Thomas Butler Date: Fri, 24 Apr 2026 19:12:53 +0100 Subject: [PATCH] Relocate chat Edge Fn into Vercel root; pin sklearn 1.7.2 Two independent production issues in one commit: 1. AI Analysis was returning 405 because api/chat.ts lived at the repo root, outside Vercel's project root (frontend/). Vercel only detects serverless/edge functions inside the project root, so the Edge Fn was never deployed. /api/chat POSTs fell through to the SPA catch-all rewrite, which tries to POST index.html (a static file) and returns 405. Moving the file into frontend/api/ lets Vercel auto-detect and mount it at /api/chat as intended. The dev-path proxy in vite.config.ts is location-independent, so dev behaviour is unchanged. 2. Render deploy log was emitting three sklearn InconsistentVersionWarning lines because the joblib at backend/models/xgboost_free_tier.joblib was saved under sklearn 1.7.2 while the container was pinned to 1.6.1. Pinning the container to 1.7.2 matches the artifacts and removes the "might lead to breaking code or invalid results" risk. 1.7.2 is stable and API-compatible with the calls in train_free_tier.py. --- backend/requirements.txt | 2 +- {api => frontend/api}/chat.ts | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename {api => frontend/api}/chat.ts (100%) diff --git a/backend/requirements.txt b/backend/requirements.txt index d4710372..79a7432f 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -2,7 +2,7 @@ # Core ML xgboost==2.1.3 -scikit-learn==1.6.1 +scikit-learn==1.7.2 joblib==1.4.2 optuna==4.3.0 diff --git a/api/chat.ts b/frontend/api/chat.ts similarity index 100% rename from api/chat.ts rename to frontend/api/chat.ts