Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -6,6 +6,7 @@ from routers.llm_chat import router as llm_chat_router
|
|
6 |
from routers.scraping_router import router as scraping_router
|
7 |
from routers.electronics_router import router as electronics_router
|
8 |
from fastapi.staticfiles import StaticFiles
|
|
|
9 |
|
10 |
app = FastAPI(
|
11 |
title="LLM Chat API",
|
@@ -22,14 +23,19 @@ app.add_middleware(
|
|
22 |
allow_headers=["*"], # Allows all headers
|
23 |
)
|
24 |
|
25 |
-
# Add UI
|
26 |
-
app.mount("/", StaticFiles(directory="static/ui", html=True), name="index")
|
27 |
|
28 |
# Include the routers
|
29 |
app.include_router(llm_chat_router)
|
30 |
app.include_router(scraping_router)
|
31 |
app.include_router(electronics_router)
|
32 |
|
|
|
|
|
|
|
|
|
|
|
33 |
# Add to main.py
|
34 |
@app.get("/routes")
|
35 |
async def get_routes():
|
|
|
6 |
from routers.scraping_router import router as scraping_router
|
7 |
from routers.electronics_router import router as electronics_router
|
8 |
from fastapi.staticfiles import StaticFiles
|
9 |
+
from fastapi.responses import FileResponse
|
10 |
|
11 |
app = FastAPI(
|
12 |
title="LLM Chat API",
|
|
|
23 |
allow_headers=["*"], # Allows all headers
|
24 |
)
|
25 |
|
26 |
+
# Add Additional UI pages # Add index.html at static/ui/page2
|
27 |
+
# app.mount("/page2", StaticFiles(directory="static/ui/page2", html=True), name="index")
|
28 |
|
29 |
# Include the routers
|
30 |
app.include_router(llm_chat_router)
|
31 |
app.include_router(scraping_router)
|
32 |
app.include_router(electronics_router)
|
33 |
|
34 |
+
# Serve index.html at root
|
35 |
+
@app.get("/")
|
36 |
+
async def read_root():
|
37 |
+
return FileResponse("static/ui/index.html")
|
38 |
+
|
39 |
# Add to main.py
|
40 |
@app.get("/routes")
|
41 |
async def get_routes():
|