Skip to content
Closed
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
8 changes: 8 additions & 0 deletions RAGManager/app/api/routes/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
"""API routes package."""

from fastapi import APIRouter

from app.api.routes import admin, documents

router = APIRouter(prefix="/api/v1")

router.include_router(documents.router)
router.include_router(admin.router)
11 changes: 11 additions & 0 deletions RAGManager/app/api/routes/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from fastapi import APIRouter

router = APIRouter(prefix="/admin", tags=["admin"])

@router.get("/health")
def admin_health():
return {"status": "ok"}

@router.get("/ping")
def admin_ping():
return {"pong": True}
11 changes: 11 additions & 0 deletions RAGManager/app/api/routes/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from fastapi import APIRouter

router = APIRouter(tags=["base"])

@router.get("/")
async def root():
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The root endpoint is defined as async but doesn't perform any async operations. Consider removing the async keyword for consistency with the health_check endpoint, or make health_check async for consistency.

Suggested change
async def root():
def root():

Copilot uses AI. Check for mistakes.
return {"message": "RAGManager up"}

@router.get("/health")
def health_check():
return {"message": "200 running..."}
Copy link

Copilot AI Dec 16, 2025

Choose a reason for hiding this comment

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

The health check message '200 running...' is inconsistent with similar endpoints. Consider using a more standardized response format like {\"status\": \"ok\"} to match the admin health endpoint pattern.

Suggested change
return {"message": "200 running..."}
return {"status": "ok"}

Copilot uses AI. Check for mistakes.
24 changes: 7 additions & 17 deletions RAGManager/main.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging
from fastapi import FastAPI
from sqlalchemy.exc import OperationalError

from app.api.routes import documents
from app.api.routes import router as api_router
from app.api.routes.base import router as base_router
from app.core.database_connection import init_db

# Configure logging
Expand All @@ -13,9 +13,11 @@

app = FastAPI(title="RAG Manager API", version="0.1.0")

# Include routers
app.include_router(documents.router)
# Global (non-versioned) routes
app.include_router(base_router)

# Versioned API routes
app.include_router(api_router)

@app.on_event("startup")
async def startup_event():
Expand All @@ -25,16 +27,4 @@ async def startup_event():
logging.info("Database initialized successfully")
except Exception as e:
logging.error(f"Failed to initialize database: {e}")
raise


@app.get("/")
async def root():
return {"message": "Hello World"}


@app.get("/health")
def health_check():
return {"message": "200 corriendo..."}


raise