Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions .vercelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Vercel ignore - exclude large files and unnecessary items for deployment
__pycache__/
*.pyc
*.pyo
*.pyd
.Python
env/
venv/
agent-env/

# Large model files
*.bin
*.safetensors
*.json
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Vercel Ignore Excludes Essential JSON Files

The *.json pattern in .vercelignore is overly broad, excluding all JSON files from deployment instead of just large model files as intended. This prevents necessary configuration files (e.g., package.json) and data files from being deployed, breaking the application or deployment.

Fix in Cursor Fix in Web

*.msgpack
*.h5
*.onnx

# Cache directories
.cache/
huggingface/
transformers_cache/

# Logs
*.log
logs/
server*.log

# Database files
*.db
*.sqlite
chroma_db/

# QA testing files
qa_screenshots/
qa_test_report.json
playwright-report/
test-results/

# Mobile node modules
mobile/node_modules/
mobile/.expo/

# Large test files
comprehensive_qa_test.py
playwright_qa_framework.py
enhanced_qa_framework.py
visual_test_engine.py

# Development tools
autonomous_launcher.py
goose_style_config.py
vercel_deployment_tool.py

# Static files that should be in frontend
backend/static/
backend/templates/test_*.html
backend/templates/spiritual_quest.html
backend/quote_readability_demo.html

# Documentation (keep README.md)
AUTONOMOUS_SYSTEM_SUMMARY.md
BUILD_ACTION_PLAN.md
backend/QA_FRAMEWORK_README.md
backend/SYSTEM_OVERVIEW.md
97 changes: 97 additions & 0 deletions api/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
#!/usr/bin/env python3
"""
🌟 Bahá'í Spiritual Quest - Vercel API Endpoint
Optimized for serverless deployment
"""

from fastapi import FastAPI, Request, Form, HTTPException
from fastapi.responses import HTMLResponse
from fastapi.templating import Jinja2Templates
from fastapi.middleware.cors import CORSMiddleware
import os
import json
from datetime import datetime
from pathlib import Path

# Initialize FastAPI app
app = FastAPI(title="Bahá'í Spiritual Quest API")

# CORS middleware
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)

# Templates
templates_dir = Path(__file__).parent.parent / "templates"
templates = Jinja2Templates(directory=str(templates_dir))

# Simple in-memory responses for Vercel deployment
SPIRITUAL_RESPONSES = [
"O Son of Being! Love Me, that I may love thee. If thou lovest Me not, My love can in no wise reach thee.",
"O Friend! In the garden of thy heart plant naught but the rose of love, and from the nightingale of affection and desire loathe not to turn away.",
"O Son of Man! For everything there is a sign. The sign of love is fortitude in My decree and patience in My trials.",
"O Children of Men! Know ye not why We created you all from the same dust? That no one should exalt himself over the other.",
"O Son of Spirit! Noble have I created thee, yet thou hast abased thyself. Rise then unto that for which thou wast created.",
"O My Friend! Thou art the daystar of the heavens of My holiness, let not the defilement of the world eclipse thy splendor.",
"O Son of Being! Thy heart is My home; sanctify it for My descent. Thy spirit is My place of revelation; cleanse it for My manifestation.",
"O Son of Man! Breathe not the sins of others so long as thou art thyself a sinner. Shouldst thou transgress this command, accursed wouldst thou be, and to this I bear witness.",
"O Son of Being! How couldst thou forget thine own faults and busy thyself with the faults of others? Whoso doeth this is accursed of Me.",
"O Son of Being! Seek a martyr's death in My path, content with My pleasure and thankful for that which hath befallen thee, for thus wilt thou abide in prosperity and comfort in the realm of eternity.",
]

@app.get("/", response_class=HTMLResponse)
async def home(request: Request):
"""Serve the main interface"""
return templates.TemplateResponse("elegant_bahai_manuscript.html", {"request": request})

@app.post("/api/chat")
async def chat_endpoint(message: str = Form(...)):
"""Simplified chat endpoint for Vercel"""
try:
# Simple keyword-based response selection
message_lower = message.lower()

if "love" in message_lower:
response = SPIRITUAL_RESPONSES[0] # Love quote
elif "friend" in message_lower:
response = SPIRITUAL_RESPONSES[1] # Friend quote
elif "son of man" in message_lower:
response = SPIRITUAL_RESPONSES[2] # Son of Man quote
elif "noble" in message_lower or "spirit" in message_lower:
response = SPIRITUAL_RESPONSES[4] # Noble quote
elif "heart" in message_lower:
response = SPIRITUAL_RESPONSES[6] # Heart quote
else:
# Random spiritual response
import hashlib
hash_obj = hashlib.md5(message.encode())
hash_int = int(hash_obj.hexdigest(), 16)
response = SPIRITUAL_RESPONSES[hash_int % len(SPIRITUAL_RESPONSES)]

return {
"message": message,
"response": response,
"timestamp": datetime.now().isoformat(),
"source": "The Hidden Words of Bahá'u'lláh"
}

except Exception as e:
raise HTTPException(status_code=500, detail=str(e))

@app.get("/api/health")
async def health_check():
"""Health check endpoint"""
return {
"status": "healthy",
"service": "Bahá'í Spiritual Quest",
"timestamp": datetime.now().isoformat()
}

# For Vercel serverless deployment
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
2 changes: 1 addition & 1 deletion backend/vercel_deployment_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class VercelDeploymentTool:
def __init__(self):
self.project_root = Path(__file__).parent.parent
self.backend_dir = Path(__file__).parent
self.github_username = "yacinewatchandcode"
self.github_username = "yacinewhatchandcode"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: GitHub Username Typo Causes Deployment Failures

A typo was introduced in the GitHub username, changing yacinewatchandcode to yacinewhatchandcode (an extra 'h' was inserted, changing "watch" to "whatch"). This will cause GitHub repository operations and deployments to fail due to the incorrect username.

Fix in Cursor Fix in Web

self.repo_name = "bahai-spiritual-quest"
self.vercel_project_name = "bahai-spiritual-quest"

Expand Down
Loading
Loading