Niansuh commited on
Commit
8ce0841
·
verified ·
1 Parent(s): cf30c69

Update api/routes.py

Browse files
Files changed (1) hide show
  1. api/routes.py +10 -8
api/routes.py CHANGED
@@ -1,18 +1,20 @@
 
 
1
  import json
2
  from fastapi import APIRouter, Depends, HTTPException, Request, Response
3
  from fastapi.responses import StreamingResponse, JSONResponse
4
  from api.auth import verify_app_secret
5
  from api.config import GIZAI_API_ENDPOINT, GIZAI_BASE_URL
6
  from api.models import ChatRequest, ImageResponseModel, ChatCompletionResponse
7
- from api.utils import process_gizai_response
8
  from api.logger import setup_logger
9
 
10
  logger = setup_logger(__name__)
11
 
12
  router = APIRouter()
13
 
14
- @router.options("/v1/chat/completions")
15
- @router.options("/api/v1/chat/completions")
16
  async def gizai_chat_completions_options():
17
  return Response(
18
  status_code=200,
@@ -23,13 +25,13 @@ async def gizai_chat_completions_options():
23
  },
24
  )
25
 
26
- @router.get("/v1/models")
27
- @router.get("/api/v1/models")
28
  async def list_gizai_models():
29
- return {"object": "list", "data": GizAI.models} # Assuming GizAI.models is accessible
30
 
31
- @router.post("/v1/chat/completions")
32
- @router.post("/api/v1/chat/completions")
33
  async def gizai_chat_completions(
34
  request: ChatRequest, app_secret: str = Depends(verify_app_secret)
35
  ):
 
1
+ # api/routes.py
2
+
3
  import json
4
  from fastapi import APIRouter, Depends, HTTPException, Request, Response
5
  from fastapi.responses import StreamingResponse, JSONResponse
6
  from api.auth import verify_app_secret
7
  from api.config import GIZAI_API_ENDPOINT, GIZAI_BASE_URL
8
  from api.models import ChatRequest, ImageResponseModel, ChatCompletionResponse
9
+ from api.utils import process_gizai_response, GizAI # Import GizAI here
10
  from api.logger import setup_logger
11
 
12
  logger = setup_logger(__name__)
13
 
14
  router = APIRouter()
15
 
16
+ @router.options("/v1/gizai/chat/completions")
17
+ @router.options("/api/v1/gizai/chat/completions")
18
  async def gizai_chat_completions_options():
19
  return Response(
20
  status_code=200,
 
25
  },
26
  )
27
 
28
+ @router.get("/v1/gizai/models")
29
+ @router.get("/api/v1/gizai/models")
30
  async def list_gizai_models():
31
+ return {"object": "list", "data": GizAI.models} # Access GizAI.models directly
32
 
33
+ @router.post("/v1/gizai/chat/completions")
34
+ @router.post("/api/v1/gizai/chat/completions")
35
  async def gizai_chat_completions(
36
  request: ChatRequest, app_secret: str = Depends(verify_app_secret)
37
  ):