This commit is contained in:
恍兮惚兮 2024-09-04 10:21:27 +08:00
parent 314f34104e
commit b03d00d30d

View File

@ -192,6 +192,8 @@ class TS(basetrans):
if not output.headers["Content-Type"].startswith("text/event-stream"): if not output.headers["Content-Type"].startswith("text/event-stream"):
raise Exception(output.text) raise Exception(output.text)
for o in output.iter_lines(): for o in output.iter_lines():
if o == b"data: [DONE]":
break
try: try:
res = o.decode("utf-8").strip()[6:] # .replace("data: ", "") res = o.decode("utf-8").strip()[6:] # .replace("data: ", "")
# print(res) # print(res)