fastAPIv2 / app.py
ragV98's picture
webhook integration
3566f32
import os
import sys
from fastapi import FastAPI
# Add paths to sys.path to allow relative imports
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "components")))
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "routes")))
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "routes", "api")))
# Import your API routes
from routes.api import ingest # routes/api/ingest.py
from routes.api import query # routes/api/query.py
from routes.api import headlines # routes/api/headlines.py
from routes.api import wa_headlines # routes/api/wa_headlines.py
from routes.api import whatsapp_webhook as whatsapp_webhook_router_module
# Optional: Global Settings (LlamaIndex)
from llama_index.core.settings import Settings
Settings.llm = None
# Create FastAPI app
app = FastAPI()
@app.get("/")
def greet():
return {"welcome": "nuse ai"}
# Include your route modules
app.include_router(ingest.router)
app.include_router(query.router)
app.include_router(headlines.router)
app.include_router(wa_headlines.router)
app.include_router(whatsapp_webhook_router_module.router, prefix="/api/whatsapp", tags=["WhatsApp Webhook"])