File size: 1,146 Bytes
6ca0914
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from fastapi import FastAPI
import os
import logging

# Set up logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

# Initialize FastAPI app
app = FastAPI(title="Mental Health Counselor API")

# Create necessary directories
os.makedirs("data/users", exist_ok=True)
os.makedirs("data/sessions", exist_ok=True)
os.makedirs("data/conversations", exist_ok=True)
os.makedirs("data/feedback", exist_ok=True)

# Define a simple health check route
@app.get("/health")
async def health_check():
    return {"status": "ok", "message": "Mental Health Counselor API is running"}

# Define a simple root route
@app.get("/")
async def root():
    return {
        "app": "Mental Health Counselor API",
        "status": "running",
        "endpoints": [
            "/health",
            "/api-docs"
        ]
    }

# Import the actual API if the file exists
try:
    from api_mental_health import app as full_app
    # Merge the routes from the full app
    app.routes.extend(full_app.routes)
    logger.info("Loaded full API functionality")
except ImportError:
    logger.warning("Could not import full API functionality")