File size: 2,633 Bytes
7e3f07e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
from __future__ import annotations

# FastAPI core imports
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware

# Routers from storage module
from storage.media_routers import router as media_router
from storage.db_routers import router as db_router
from storage.embeddings_routers import router as embeddings_router
from storage.pending_videos_routers import router as pending_videos_router
from storage.data_routers import router as data_router

# Routers from main process module
from main_process.main_router import router as main_router
from main_process.salamandra_router import router as salamandra_router
from main_process.moe_router import router as moe_router
from main_process.refinement_router import router as refinement_router

# Preprocessing router
from preprocessing_router import router as preprocessing_router


# ---------------------------------------------------------
# FastAPI Application Initialization
# ---------------------------------------------------------

app = FastAPI(
    title="Veureu Engine API",
    version="0.2.0",
    description="API providing access to Veureu Engine services."
)


# ---------------------------------------------------------
# CORS Configuration
# ---------------------------------------------------------

# Allow all origins for now — adjust for production environments
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],           # Allows requests from any origin
    allow_credentials=True,
    allow_methods=["*"],           # Allows all HTTP methods
    allow_headers=["*"],           # Allows all HTTP headers
)


# ---------------------------------------------------------
# Router Registration
# ---------------------------------------------------------

# Storage-related routers
app.include_router(data_router)
app.include_router(media_router)
app.include_router(db_router)
app.include_router(embeddings_router)
app.include_router(pending_videos_router)

# Main process routers
app.include_router(main_router)
app.include_router(salamandra_router)
app.include_router(moe_router)
app.include_router(refinement_router)

# Preprocessing router with prefix
app.include_router(preprocessing_router, prefix="/preprocessing")


# ---------------------------------------------------------
# Root Endpoint
# ---------------------------------------------------------

@app.get("/", summary="Root endpoint", tags=["health"])
def root():
    """
    Root health-check endpoint.

    Returns:
        dict: A minimal JSON response indicating that the service is running.
    """
    return {"ok": True, "service": "veureu-engine"}