Arvind2006 commited on
Commit
e05c450
·
verified ·
1 Parent(s): 5a4055f

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +16 -13
main.py CHANGED
@@ -1,13 +1,16 @@
1
- from fastapi import FastAPI
2
- from explain_error import explain_error
3
-
4
- app = FastAPI()
5
-
6
- @app.get("/")
7
- def home():
8
- return {"message": "Jenkins Error Explainer API running"}
9
-
10
- @app.post("/explain")
11
- def explain(payload: dict):
12
- log = payload["log_text"]
13
- return explain_error(log)
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from explain_error import explain_error
3
+
4
+ app = FastAPI()
5
+
6
+ from fastapi.responses import RedirectResponse
7
+
8
+ @app.get("/")
9
+ def redirect_to_docs():
10
+ return RedirectResponse(url="/docs")
11
+
12
+
13
+ @app.post("/explain")
14
+ def explain(payload: dict):
15
+ log = payload["log_text"]
16
+ return explain_error(log)