Skip to content

Commit

Permalink
Update httpxHelp.py
Browse files Browse the repository at this point in the history
  • Loading branch information
duolabmeng6 committed Sep 15, 2024
1 parent ac8f2f2 commit 429c267
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/provider/httpxHelp.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ async def raise_for_status(sendReady, response: httpx.Response):
# print("raise_for_status", response.status_code)
return
response_content = await response.aread()
new_url = sendReady.get("url")
# 截取域名部分
new_url = new_url.split("//")[-1]

error_data = {
"error": "上游服务器出现错误",
"response_body": response_content.decode("utf-8"),
"status_code": response.status_code,
"model": sendReady.get("model"),
"body": sendReady.get("body"),
"url": sendReady.get("url"),
"url": new_url,
}
raise HTTPException(status_code=500, detail=error_data)

Expand Down Expand Up @@ -101,7 +105,6 @@ async def get_api_data_cache(sendReady) -> AsyncGenerator[str, None]:
else:
logger.info(f"没有命中缓存{cache_md5}")


cacheData = ""
try:
if sendReady["stream"]:
Expand Down

0 comments on commit 429c267

Please sign in to comment.