diff --git a/chains/local_doc_qa.py b/chains/local_doc_qa.py index da83da7..1b8c35e 100644 --- a/chains/local_doc_qa.py +++ b/chains/local_doc_qa.py @@ -242,7 +242,7 @@ if __name__ == "__main__": vs_path=vs_path, chat_history=[], streaming=True): - print(resp["result"][last_print_len:], end="", flush=True) + print(resp["result"][last_print_len:]) last_print_len = len(resp["result"]) source_text = [f"""出处 [{inum + 1}] {os.path.split(doc.metadata['source'])[-1]}:\n\n{doc.page_content}\n\n""" # f"""相关度:{doc.metadata['score']}\n\n""" diff --git a/cli_demo.py b/cli_demo.py index 245412e..eb0f7e2 100644 --- a/cli_demo.py +++ b/cli_demo.py @@ -31,7 +31,7 @@ if __name__ == "__main__": chat_history=history, streaming=STREAMING): if STREAMING: - logger.info(resp["result"][last_print_len:], end="", flush=True) + logger.info(resp["result"][last_print_len:]) last_print_len = len(resp["result"]) else: logger.info(resp["result"]) diff --git a/models/chatglm_llm.py b/models/chatglm_llm.py index 0cac961..765cf02 100644 --- a/models/chatglm_llm.py +++ b/models/chatglm_llm.py @@ -175,7 +175,7 @@ if __name__ == "__main__": llm_device=LLM_DEVICE, ) last_print_len = 0 for resp, history in llm._call("你好", streaming=True): - logger.info(resp[last_print_len:], end="", flush=True) + logger.info(resp[last_print_len:]) last_print_len = len(resp) for resp, history in llm._call("你好", streaming=False): logger.info(resp)