From 165500be2db903b2e474777a1f8a383aa2ea74ad Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Fri, 17 Nov 2023 04:36:40 +0800 Subject: [PATCH] 0.1.34 --- PyPI/setup.cfg | 2 +- PyPI/src/guan.egg-info/PKG-INFO | 2 +- PyPI/src/guan/data_processing.py | 31 +++++++++++++++++-------------- 3 files changed, 19 insertions(+), 16 deletions(-) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index ee05fc3..20eff81 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.33 +version = 0.1.34 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index 91780af..201f02a 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: guan -Version: 0.1.33 +Version: 0.1.34 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/data_processing.py b/PyPI/src/guan/data_processing.py index 70a0013..af3651b 100644 --- a/PyPI/src/guan/data_processing.py +++ b/PyPI/src/guan/data_processing.py @@ -401,20 +401,23 @@ def chat(prompt='你好', stream_show=1, top_p=0.8, temperature=0.8): send_message = json.dumps(message) client_socket.send(send_message.encode()) while True: - data = client_socket.recv(1024) - stream_response = data.decode() - response_dict = json.loads(stream_response) - stream_response = response_dict['response'] - end_message = response_dict['end_message'] - if end_message == 1: - break - elif stream_response == '': - break - else: - if stream_show == 1: - print(stream_response) - print('\n---\n') - response = stream_response + try: + data = client_socket.recv(1024) + stream_response = data.decode() + response_dict = json.loads(stream_response) + stream_response = response_dict['response'] + end_message = response_dict['end_message'] + if end_message == 1: + break + elif stream_response == '': + break + else: + if stream_show == 1: + print(stream_response) + print('\n---\n') + response = stream_response + except: + pass client_socket.close() import guan guan.statistics_of_guan_package()