diff --git a/.changeset/forty-ads-tell.md b/.changeset/forty-ads-tell.md new file mode 100644 index 00000000..ef9fed95 --- /dev/null +++ b/.changeset/forty-ads-tell.md @@ -0,0 +1,5 @@ +--- +"create-llama": patch +--- + +Add redirect to documentation page when accessing the base URL diff --git a/templates/types/streaming/fastapi/main.py b/templates/types/streaming/fastapi/main.py index edba3d3a..4ffd54f3 100644 --- a/templates/types/streaming/fastapi/main.py +++ b/templates/types/streaming/fastapi/main.py @@ -7,6 +7,7 @@ import uvicorn from fastapi import FastAPI from fastapi.middleware.cors import CORSMiddleware +from fastapi.responses import RedirectResponse from app.api.routers.chat import chat_router from app.settings import init_settings @@ -29,6 +30,12 @@ allow_headers=["*"], ) + # Redirect to documentation page when accessing base URL + @app.get("/") + async def redirect_to_docs(): + return RedirectResponse(url="/docs") + + app.include_router(chat_router, prefix="/api/chat")