This commit is contained in:
guanjihuan 2023-11-17 04:36:40 +08:00
parent 9f012a9564
commit 165500be2d
3 changed files with 19 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -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()