This commit is contained in:
恍兮惚兮 2024-09-04 10:32:40 +08:00
parent b03d00d30d
commit b8a548af7d

View File

@ -192,10 +192,11 @@ 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]": o = o.decode("utf-8").strip()
if o == "data: [DONE]":
break break
try: try:
res = o.decode("utf-8").strip()[6:] # .replace("data: ", "") res = o[6:]
# print(res) # print(res)
if res == "": if res == "":
continue continue