# Copy this entire prompt to share with another AI

---

## Context

I'm preparing EventheOdds.ai (a sports analytics platform with AI chat) for a demo tomorrow with 5 testers. I need help fixing critical bugs.

## Tech Stack
- Next.js 15 with Turbopack
- PostgreSQL database (sports data)
- Grok AI for chat responses
- PM2 process manager
- Node.js v20

## Current Critical Issues

### Issue 1: Chat API Requires Authentication
The `/api/chat` endpoint returns "No authentication token provided" for unauthenticated requests. For the demo, testers need to either:
- Have pre-created test accounts, OR
- Have a demo/bypass mode for testing

**Question:** What's the best approach for a demo? Should I:
a) Create test accounts and give credentials to testers
b) Add a demo mode that bypasses auth temporarily
c) Add an internal API key for testing
d) Something else?

### Issue 2: Duplicate Game Records in Database
Same games are stored twice - once with team abbreviations ("ATL") and once with full names ("Atlanta Hawks"). This causes:
- 96 duplicate NHL games
- 64 duplicate NBA games
- Duplicate entries in standings/analytics

**Need:** A safe SQL script or approach to deduplicate these while keeping the record with more complete data.

### Issue 3: Browser Cache Issues After Deployment
After rebuilding the app, browsers with cached JavaScript get "Failed to find Server Action" errors. Users need to hard-refresh (Ctrl+Shift+R).

**Question:** What's the best way to prevent this? Cache-busting? Headers?

### Issue 4: Missing Team Data in Injuries
Some injury records have empty team fields:
- 148 NFL injuries missing team
- 55 MLB injuries missing team

These players aren't in our CanonicalPlayer table so we can't backfill from there.

**Question:** Should we:
a) Fuzzy match player names to find teams
b) Pull team from the original injury source
c) Leave as-is (minor issue)
d) Other approach?

## What's Working
- Player data is current (recent trades reflected)
- 25 NBA games in database for today
- Health check passes
- Analytics APIs work
- Chat logic is updated with dynamic seasons

## Key Files If You Need Them
- Chat logic: `/src/lib/chat.ts` (~6500 lines)
- Auth middleware: Would need to check
- Database schema: `/prisma_sports/schema.prisma`

## Constraints
- Demo is tomorrow - need quick, safe fixes
- Can't break production
- Prefer minimal code changes

## What I Need From You
1. Recommended approach for each issue
2. Code snippets if applicable
3. Risk assessment for each fix
4. Priority order for fixing

Thanks!
