Delete api
Browse files- api/utils.py +0 -17
api/utils.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
import httpx
|
| 2 |
-
import logging
|
| 3 |
-
|
| 4 |
-
async def process_non_streaming_response(request):
|
| 5 |
-
try:
|
| 6 |
-
async with httpx.AsyncClient() as client:
|
| 7 |
-
# 通过Cloudflare Worker访问
|
| 8 |
-
response = await client.post(
|
| 9 |
-
"https://hfblackbox.1224435936.workers.dev/api/v1/chat/completions",
|
| 10 |
-
json=await request.json(),
|
| 11 |
-
headers=dict(request.headers)
|
| 12 |
-
)
|
| 13 |
-
response.raise_for_status()
|
| 14 |
-
return response.json()
|
| 15 |
-
except Exception as e:
|
| 16 |
-
logging.error(f"请求失败: {str(e)}")
|
| 17 |
-
raise
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|