LangChainGo / socket_client.py
lizhen
LangChain openAI快速接入。
5bd6c7f
raw
history blame
332 Bytes
#!/usr/bin/python3
import socket
import sys
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
host = socket.gethostname()
port = 9999
s.connect((host,port))
while True:
msg = s.recv(1024).decode("utf-8")
print("server:",msg)
msg = input("client: ")
if not msg: break
s.sendall(msg.encode("utf-8"))
s.close()