fix: migrate AI chat system from Firebase/Firestore to Postgres

Firebase was not configured so every chat request crashed with
'Firebase Admin credentials not configured'.

- chat-mode-resolver.ts: read project phase from fs_projects (Postgres)
- chat-context.ts: load project data from fs_projects instead of Firestore
- /api/ai/conversation: store/retrieve conversations in chat_conversations
  Postgres table (created automatically on first use)
- /api/ai/chat: replace all Firestore reads/writes with Postgres queries
- v_ai_chat/page.tsx: replace Firebase client auth with useSession from
  next-auth/react; remove Firestore listeners, use REST API for project data

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-19 12:07:03 -08:00
parent a281d4d373
commit e3a6641e3c
6 changed files with 193 additions and 350 deletions

View File

@@ -43,4 +43,3 @@ export default function AuthPage() {
</Suspense>
);
}