Increase the initial character read timeout.
Browse files
main.py
CHANGED
@@ -20,7 +20,7 @@ from fastapi.middleware.cors import CORSMiddleware
|
|
20 |
@asynccontextmanager
|
21 |
async def lifespan(app: FastAPI):
|
22 |
# 启动时的代码
|
23 |
-
timeout = httpx.Timeout(connect=15.0, read=
|
24 |
app.state.client = httpx.AsyncClient(timeout=timeout)
|
25 |
yield
|
26 |
# 关闭时的代码
|
@@ -114,7 +114,7 @@ class ModelRequestHandler:
|
|
114 |
async def request_model(self, request: RequestModel, token: str):
|
115 |
model_name = request.model
|
116 |
matching_providers = self.get_matching_providers(model_name, token)
|
117 |
-
print("matching_providers", json.dumps(matching_providers, indent=4, ensure_ascii=False))
|
118 |
|
119 |
if not matching_providers:
|
120 |
raise HTTPException(status_code=404, detail="No matching model found")
|
|
|
20 |
@asynccontextmanager
|
21 |
async def lifespan(app: FastAPI):
|
22 |
# 启动时的代码
|
23 |
+
timeout = httpx.Timeout(connect=15.0, read=10.0, write=30.0, pool=30.0)
|
24 |
app.state.client = httpx.AsyncClient(timeout=timeout)
|
25 |
yield
|
26 |
# 关闭时的代码
|
|
|
114 |
async def request_model(self, request: RequestModel, token: str):
|
115 |
model_name = request.model
|
116 |
matching_providers = self.get_matching_providers(model_name, token)
|
117 |
+
# print("matching_providers", json.dumps(matching_providers, indent=4, ensure_ascii=False))
|
118 |
|
119 |
if not matching_providers:
|
120 |
raise HTTPException(status_code=404, detail="No matching model found")
|