Spaces:
Sleeping
Sleeping
Upload app.py with huggingface_hub
Browse files
app.py
CHANGED
|
@@ -53,7 +53,7 @@ class AnthropicRequest(BaseModel):
|
|
| 53 |
|
| 54 |
def get_proxies():
|
| 55 |
if PROXY_URL:
|
| 56 |
-
return
|
| 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 |
-
|
|
|
|
| 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:
|