print flush for the streaming out put instead
This commit is contained in:
@@ -77,10 +77,12 @@ def main():
|
|||||||
# 避免偶发回退
|
# 避免偶发回退
|
||||||
delta = current_text
|
delta = current_text
|
||||||
if delta:
|
if delta:
|
||||||
u = delta
|
u = delta
|
||||||
last_text = current_text
|
last_text = current_text
|
||||||
|
|
||||||
logger.info(f"from stream: {u}")
|
# For streaming responses, print incrementally to stdout and flush
|
||||||
|
# so the user can see tokens as they arrive.
|
||||||
|
print(u, end="", flush=True)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# 非流式回落(一次性返回)
|
# 非流式回落(一次性返回)
|
||||||
if responses.status_code != HTTPStatus.OK:
|
if responses.status_code != HTTPStatus.OK:
|
||||||
|
|||||||
Reference in New Issue
Block a user