rkihacker commited on
Commit
4988762
·
verified ·
1 Parent(s): 48a3069

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -4
main.py CHANGED
@@ -7,7 +7,7 @@ from contextlib import asynccontextmanager
7
 
8
  # --- Configuration ---
9
  # The target URL is configurable via an environment variable.
10
- TARGET_URL = os.getenv("TARGET_URL", "https://api.gmi-serving.com/v1/chat/completions")
11
 
12
  # --- HTTPX Client Lifecycle Management ---
13
  @asynccontextmanager
@@ -92,12 +92,12 @@ async def _reverse_proxy(request: Request):
92
 
93
  # --- API Endpoint ---
94
  @app.api_route(
95
- "/chat",
96
  methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"]
97
  )
98
  async def chat_proxy_handler(request: Request):
99
  """
100
- This endpoint captures requests specifically for the "/chat" path
101
  and forwards them through the reverse proxy.
102
  """
103
  return await _reverse_proxy(request)
@@ -106,6 +106,6 @@ async def chat_proxy_handler(request: Request):
106
  @app.get("/")
107
  async def health_check():
108
  """Provides a basic health check endpoint."""
109
- return {"status": "ok", "proxying_endpoint": "/chat", "target": "TypeGPT"}
110
 
111
  # Any request to a path other than "/chat" or "/" will result in a 404 Not Found.
 
7
 
8
  # --- Configuration ---
9
  # The target URL is configurable via an environment variable.
10
+ TARGET_URL = os.getenv("TARGET_URL", "https://api.gmi-serving.com/v1/chat")
11
 
12
  # --- HTTPX Client Lifecycle Management ---
13
  @asynccontextmanager
 
92
 
93
  # --- API Endpoint ---
94
  @app.api_route(
95
+ "/completions",
96
  methods=["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"]
97
  )
98
  async def chat_proxy_handler(request: Request):
99
  """
100
+ This endpoint captures requests specifically for the "/completions" path
101
  and forwards them through the reverse proxy.
102
  """
103
  return await _reverse_proxy(request)
 
106
  @app.get("/")
107
  async def health_check():
108
  """Provides a basic health check endpoint."""
109
+ return {"status": "ok", "proxying_endpoint": "/completions", "target": "TypeGPT"}
110
 
111
  # Any request to a path other than "/chat" or "/" will result in a 404 Not Found.