feat: implement AI chat with vector search and random loading messages

Major Features:
-  AI chat with Azure OpenAI GPT-4o integration
-  Vector search across Bible versions (ASV English, RVA 1909 Spanish)
-  Multi-language support with automatic English fallback
-  Bible version citations in responses [ASV] [RVA 1909]
-  Random Bible-themed loading messages (5 variants)
-  Safe build script with memory guardrails
-  8GB swap memory for build safety
-  Stripe donation integration (multiple payment methods)

AI Chat Improvements:
- Implement vector search with 1536-dim embeddings (Azure text-embedding-ada-002)
- Search all Bible versions in user's language, fallback to English
- Cite Bible versions properly in AI responses
- Add 5 random loading messages: "Searching the Scriptures...", etc.
- Fix Ollama conflict (disabled to use Azure OpenAI exclusively)
- Optimize hybrid search queries for actual table schema

Build & Infrastructure:
- Create safe-build.sh script with memory monitoring (prevents server crashes)
- Add 8GB swap memory for emergency relief
- Document build process in BUILD_GUIDE.md
- Set Node.js memory limits (4GB max during builds)

Database:
- Clean up 115 old vector tables with wrong dimensions
- Keep only 2 tables with correct 1536-dim embeddings
- Add Stripe schema for donations and subscriptions

Documentation:
- AI_CHAT_FINAL_STATUS.md - Complete implementation status
- AI_CHAT_IMPLEMENTATION_COMPLETE.md - Technical details
- BUILD_GUIDE.md - Safe building guide with guardrails
- CHAT_LOADING_MESSAGES.md - Loading messages implementation
- STRIPE_IMPLEMENTATION_COMPLETE.md - Stripe integration docs
- STRIPE_SETUP_GUIDE.md - Stripe configuration guide

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-12 19:37:24 +00:00
parent b3ec31a265
commit a01377b21a
20 changed files with 3022 additions and 130 deletions

View File

@@ -8,7 +8,7 @@
"build:fast": "NODE_OPTIONS='--max-old-space-size=2048' NEXT_PRIVATE_SKIP_SIZE_LIMIT=1 next build",
"build:analyze": "ANALYZE=true npm run build",
"build:prod": "NODE_OPTIONS='--max-old-space-size=8192' NODE_ENV=production next build",
"start": "next start -p 3010",
"start": "next start -p 3010 -H 0.0.0.0",
"lint": "next lint",
"import-bible": "tsx scripts/import-bible.ts",
"db:migrate": "npx prisma migrate deploy",
@@ -48,6 +48,7 @@
"@radix-ui/react-slot": "^1.2.3",
"@radix-ui/react-tabs": "^1.1.13",
"@radix-ui/react-toast": "^1.2.15",
"@stripe/stripe-js": "^8.0.0",
"@tailwindcss/postcss": "^4.1.13",
"@tinymce/tinymce-react": "^6.3.0",
"@types/node": "^24.5.2",
@@ -82,6 +83,7 @@
"remark-gfm": "^4.0.1",
"socket.io": "^4.8.1",
"socket.io-client": "^4.8.1",
"stripe": "^19.1.0",
"tailwind-merge": "^3.3.1",
"tailwindcss": "^4.1.13",
"tinymce": "^8.1.2",