Update main.py
Browse files
main.py
CHANGED
|
@@ -1,7 +1,21 @@
|
|
| 1 |
-
from fastapi import FastAPI
|
|
|
|
| 2 |
|
| 3 |
-
app = FastAPI()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
@app.get("/")
|
| 6 |
async def root():
|
| 7 |
return {"message": "Hello, World!"}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI, HTTPException
|
| 2 |
+
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
|
| 4 |
+
app = FastAPI(title="OpenWebUI API")
|
| 5 |
+
|
| 6 |
+
# Add CORS middleware
|
| 7 |
+
app.add_middleware(
|
| 8 |
+
CORSMiddleware,
|
| 9 |
+
allow_origins=["*"],
|
| 10 |
+
allow_credentials=True,
|
| 11 |
+
allow_methods=["*"],
|
| 12 |
+
allow_headers=["*"],
|
| 13 |
+
)
|
| 14 |
|
| 15 |
@app.get("/")
|
| 16 |
async def root():
|
| 17 |
return {"message": "Hello, World!"}
|
| 18 |
+
|
| 19 |
+
@app.get("/health")
|
| 20 |
+
async def health_check():
|
| 21 |
+
return {"status": "healthy"}
|