Spaces:
Sleeping
Sleeping
Ajit Panday commited on
Commit ·
6565e69
1
Parent(s): 9cc5dcd
Add root endpoint and improve API documentation
Browse files
main.py
CHANGED
|
@@ -27,7 +27,25 @@ load_dotenv()
|
|
| 27 |
# Initialize FastAPI app
|
| 28 |
app = FastAPI(
|
| 29 |
title="vBot - Voice Call Analysis API",
|
| 30 |
-
description="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
version="1.0.0"
|
| 32 |
)
|
| 33 |
|
|
@@ -48,6 +66,28 @@ sentiment_analyzer = pipeline("sentiment-analysis", model=SENTIMENT_MODEL)
|
|
| 48 |
# Include auth router
|
| 49 |
app.include_router(auth_router, prefix="/api/v1", tags=["auth"])
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
async def get_customer_by_api_key(api_key: str = Header(...), db: Session = Depends(get_db)):
|
| 52 |
"""Get customer by API key"""
|
| 53 |
customer = db.query(CustomerModel).filter(
|
|
|
|
| 27 |
# Initialize FastAPI app
|
| 28 |
app = FastAPI(
|
| 29 |
title="vBot - Voice Call Analysis API",
|
| 30 |
+
description="""
|
| 31 |
+
vBot is an AI-powered call analysis tool for Asterisk-based PBX systems.
|
| 32 |
+
|
| 33 |
+
## Features
|
| 34 |
+
* Voice call transcription using Whisper
|
| 35 |
+
* Call summary generation
|
| 36 |
+
* Sentiment analysis
|
| 37 |
+
* Multi-tenant support with isolated customer databases
|
| 38 |
+
|
| 39 |
+
## Authentication
|
| 40 |
+
* Admin access requires username/password
|
| 41 |
+
* Customer access requires API key
|
| 42 |
+
|
| 43 |
+
## API Endpoints
|
| 44 |
+
* POST /api/v1/process-call - Process a voice call recording
|
| 45 |
+
* GET /api/v1/calls - List all calls for a customer
|
| 46 |
+
* GET /api/v1/calls/{call_id} - Get specific call details
|
| 47 |
+
* GET /api/v1/health - Health check endpoint
|
| 48 |
+
""",
|
| 49 |
version="1.0.0"
|
| 50 |
)
|
| 51 |
|
|
|
|
| 66 |
# Include auth router
|
| 67 |
app.include_router(auth_router, prefix="/api/v1", tags=["auth"])
|
| 68 |
|
| 69 |
+
@app.get("/")
|
| 70 |
+
async def root():
|
| 71 |
+
"""Root endpoint providing API information"""
|
| 72 |
+
return {
|
| 73 |
+
"name": "vBot API",
|
| 74 |
+
"version": "1.0.0",
|
| 75 |
+
"description": "AI-powered call analysis tool for Asterisk-based PBX systems",
|
| 76 |
+
"endpoints": {
|
| 77 |
+
"process_call": "/api/v1/process-call",
|
| 78 |
+
"list_calls": "/api/v1/calls",
|
| 79 |
+
"get_call": "/api/v1/calls/{call_id}",
|
| 80 |
+
"health_check": "/api/v1/health",
|
| 81 |
+
"admin": {
|
| 82 |
+
"create_customer": "/api/v1/customers/",
|
| 83 |
+
"list_customers": "/api/v1/customers",
|
| 84 |
+
"get_customer": "/api/v1/customers/{customer_id}",
|
| 85 |
+
"delete_customer": "/api/v1/customers/{customer_id}"
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
"documentation": "/docs"
|
| 89 |
+
}
|
| 90 |
+
|
| 91 |
async def get_customer_by_api_key(api_key: str = Header(...), db: Session = Depends(get_db)):
|
| 92 |
"""Get customer by API key"""
|
| 93 |
customer = db.query(CustomerModel).filter(
|