overwrite69 commited on
Commit
d07e9e5
·
verified ·
1 Parent(s): 024d337

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -53,7 +53,7 @@ class AnthropicRequest(BaseModel):
53
 
54
  def get_proxies():
55
  if PROXY_URL:
56
- return {"http://": PROXY_URL, "https://": PROXY_URL}
57
  return None
58
 
59
  async def get_csrf_token(client: httpx.AsyncClient) -> str:
@@ -92,7 +92,8 @@ async def stream_chat(client: httpx.AsyncClient, model: str, messages: List[Dict
92
  continue
93
 
94
  async def do_chat(model: str, messages: List[Dict], stream: bool = False):
95
- async with httpx.AsyncClient(proxies=get_proxies(), cookies={}, http2=True, follow_redirects=True, timeout=120.0) as client:
 
96
  csrf_token = await get_csrf_token(client)
97
 
98
  if stream:
 
53
 
54
  def get_proxies():
55
  if PROXY_URL:
56
+ return PROXY_URL
57
  return None
58
 
59
  async def get_csrf_token(client: httpx.AsyncClient) -> str:
 
92
  continue
93
 
94
  async def do_chat(model: str, messages: List[Dict], stream: bool = False):
95
+ proxy = get_proxies()
96
+ async with httpx.AsyncClient(proxy=proxy, cookies={}, http2=True, follow_redirects=True, timeout=120.0) as client:
97
  csrf_token = await get_csrf_token(client)
98
 
99
  if stream: