Browse Source

healthcheck

Alex Cheema 5 months ago
parent
commit
fd867256e0
1 changed files with 4 additions and 0 deletions
  1. 4 0
      exo/api/chatgpt_api.py

+ 4 - 0
exo/api/chatgpt_api.py

@@ -173,6 +173,7 @@ class ChatGPTAPI:
     cors.add(self.app.router.add_post("/v1/chat/completions", self.handle_post_chat_completions), {"*": cors_options})
     cors.add(self.app.router.add_get("/v1/download/progress", self.handle_get_download_progress), {"*": cors_options})
     cors.add(self.app.router.add_get("/modelpool", self.handle_model_support), {"*": cors_options})
+    cors.add(self.app.router.add_get("/healthcheck", self.handle_healthcheck), {"*": cors_options})
 
     self.static_dir = Path(__file__).parent.parent/"tinychat"
     self.app.router.add_get("/", self.handle_root)
@@ -200,6 +201,9 @@ class ChatGPTAPI:
   async def handle_root(self, request):
     return web.FileResponse(self.static_dir/"index.html")
 
+  async def handle_healthcheck(self, request):
+    return web.json_response({"status": "ok"})
+
   async def handle_model_support(self, request):
     return web.json_response({
       "model pool": {