0.1.30
This commit is contained in:
parent
7190c99b8e
commit
6c2c155159
@ -1,7 +1,7 @@
|
||||
[metadata]
|
||||
# replace with your username:
|
||||
name = guan
|
||||
version = 0.1.29
|
||||
version = 0.1.30
|
||||
author = guanjihuan
|
||||
author_email = guanjihuan@163.com
|
||||
description = An open source python package
|
||||
|
@ -1,6 +1,6 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: guan
|
||||
Version: 0.1.29
|
||||
Version: 0.1.30
|
||||
Summary: An open source python package
|
||||
Home-page: https://py.guanjihuan.com
|
||||
Author: guanjihuan
|
||||
|
@ -385,14 +385,21 @@ def get_PID(name):
|
||||
return id_running
|
||||
|
||||
# 在服务器上运行大语言模型,通过Python函数调用
|
||||
def chat(prompt='你好', stream_show=1):
|
||||
def chat(prompt='你好', stream_show=1, top_p=0.8, temperature=0.8):
|
||||
import socket
|
||||
import json
|
||||
response = ''
|
||||
try:
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as client_socket:
|
||||
client_socket.settimeout(10)
|
||||
client_socket.connect(('socket.guanjihuan.com', 12345))
|
||||
send_message = "chat.guanjihuan.com |---| " + prompt
|
||||
message = {
|
||||
'server': "chat.guanjihuan.com",
|
||||
'prompt': prompt,
|
||||
'top_p': top_p,
|
||||
'temperature': temperature,
|
||||
}
|
||||
send_message = json.dumps(message)
|
||||
client_socket.send(send_message.encode())
|
||||
try:
|
||||
while True:
|
||||
@ -402,7 +409,6 @@ def chat(prompt='你好', stream_show=1):
|
||||
break
|
||||
stream_response = data.decode()
|
||||
if '连接失败!请过段时间再试或者联系管理员。' in stream_response:
|
||||
response = None
|
||||
print('连接失败!请过段时间再试或者联系管理员。')
|
||||
break
|
||||
if stream_response == '':
|
||||
@ -416,7 +422,6 @@ def chat(prompt='你好', stream_show=1):
|
||||
pass
|
||||
client_socket.close()
|
||||
except:
|
||||
response = None
|
||||
print('连接失败!请过段时间再试或者联系管理员。')
|
||||
import guan
|
||||
guan.statistics_of_guan_package()
|
||||
|
@ -30,12 +30,13 @@ def get_calling_function_name(layer=1):
|
||||
global_variable_of_first_guan_package_calling = []
|
||||
def statistics_of_guan_package():
|
||||
import guan
|
||||
message = guan.get_calling_function_name(layer=2)
|
||||
message_calling = guan.get_calling_function_name(layer=3)
|
||||
import json
|
||||
function_name = guan.get_calling_function_name(layer=2)
|
||||
function_calling_name = guan.get_calling_function_name(layer=3)
|
||||
global global_variable_of_first_guan_package_calling
|
||||
if message not in global_variable_of_first_guan_package_calling:
|
||||
global_variable_of_first_guan_package_calling.append(message)
|
||||
if message_calling == '<module>':
|
||||
if function_name not in global_variable_of_first_guan_package_calling:
|
||||
global_variable_of_first_guan_package_calling.append(function_name)
|
||||
if function_calling_name == '<module>':
|
||||
try:
|
||||
import socket
|
||||
datetime_date = guan.get_date()
|
||||
@ -45,7 +46,14 @@ def statistics_of_guan_package():
|
||||
client_socket.settimeout(0.5)
|
||||
client_socket.connect(('socket.guanjihuan.com', 12345))
|
||||
mac_address = guan.get_mac_address()
|
||||
send_message = datetime_date + ' ' + datetime_time + ' version_'+current_version + ' MAC_address: '+mac_address+' guan.' + message+'\n'
|
||||
message = {
|
||||
'date': datetime_date,
|
||||
'time': datetime_time,
|
||||
'version': current_version,
|
||||
'MAC_address': mac_address,
|
||||
'function_name': function_name
|
||||
}
|
||||
send_message = json.dumps(message)
|
||||
client_socket.send(send_message.encode())
|
||||
client_socket.close()
|
||||
except:
|
||||
|
Loading…
x
Reference in New Issue
Block a user