This commit is contained in:
taylorxie
2026-03-09 23:15:54 +08:00
parent 1070cf517f
commit caddfb61f1
2 changed files with 14 additions and 3 deletions

View File

@@ -1,3 +1,4 @@
import asyncio
import json
from collections import deque
@@ -185,7 +186,10 @@ class Anthropic(Platform):
if response.status != 200:
raise ValueError(f"Error: {await response.text()}")
while True:
line_bytes = await response.content.readline()
try:
line_bytes = await asyncio.wait_for(response.content.readline(), timeout=60.0)
except asyncio.TimeoutError:
break
if not line_bytes:
break
line = line_bytes.decode("utf-8").strip()