[Bugfix] Fix small typo in the example of Streaming delimiter (#14793)

This commit is contained in:
WeiCheng
2025-03-14 16:05:17 +08:00
committed by GitHub
parent 601bd3268e
commit 54cc46f3eb
2 changed files with 2 additions and 2 deletions

View File

@ -42,7 +42,7 @@ def post_http_request(prompt: str,
def get_streaming_response(response: requests.Response) -> Iterable[list[str]]:
for chunk in response.iter_lines(chunk_size=8192,
decode_unicode=False,
delimiter=b"\0"):
delimiter=b"\n"):
if chunk:
data = json.loads(chunk.decode("utf-8"))
output = data["text"]

View File

@ -21,7 +21,7 @@ def http_bot(prompt):
for chunk in response.iter_lines(chunk_size=8192,
decode_unicode=False,
delimiter=b"\0"):
delimiter=b"\n"):
if chunk:
data = json.loads(chunk.decode("utf-8"))
output = data["text"][0]