0.1.130
This commit is contained in:
		| @@ -1,7 +1,7 @@ | |||||||
| [metadata] | [metadata] | ||||||
| # replace with your username: | # replace with your username: | ||||||
| name = guan | name = guan | ||||||
| version = 0.1.129 | version = 0.1.130 | ||||||
| author = guanjihuan | author = guanjihuan | ||||||
| author_email = guanjihuan@163.com | author_email = guanjihuan@163.com | ||||||
| description = An open source python package | description = An open source python package | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| Metadata-Version: 2.1 | Metadata-Version: 2.1 | ||||||
| Name: guan | Name: guan | ||||||
| Version: 0.1.129 | Version: 0.1.130 | ||||||
| Summary: An open source python package | Summary: An open source python package | ||||||
| Home-page: https://py.guanjihuan.com | Home-page: https://py.guanjihuan.com | ||||||
| Author: guanjihuan | Author: guanjihuan | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| # Module: data_processing | # Module: data_processing | ||||||
|  |  | ||||||
| # 模型对话 | # 模型对话 | ||||||
| def chat(prompt='你好', model=1, stream=0, top_p=0.8, temperature=0.85): | def chat(prompt='你好', stream=1, model=1, top_p=0.8, temperature=0.85): | ||||||
|     import socket |     import socket | ||||||
|     import json |     import json | ||||||
|     with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client_socket: |     with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client_socket: | ||||||
| @@ -32,12 +32,12 @@ def chat(prompt='你好', model=1, stream=0, top_p=0.8, temperature=0.85): | |||||||
|                         break |                         break | ||||||
|                     else: |                     else: | ||||||
|                         if stream == 1: |                         if stream == 1: | ||||||
|                             print(stream_response) |                             print(stream_response, end='') | ||||||
|             except: |             except: | ||||||
|                 break |                 break | ||||||
|         client_socket.close() |         client_socket.close() | ||||||
|         if stream == 1: |         if stream == 1: | ||||||
|             print('\n--- End Stream Message ---\n') |             print('\n\n--- End Stream Message ---\n') | ||||||
|     return response |     return response | ||||||
|  |  | ||||||
| # 在云端服务器上运行函数(需要函数是独立可运行的代码) | # 在云端服务器上运行函数(需要函数是独立可运行的代码) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user