forked from neurodock/NeuroDock
Extracted the external tool base for python runner
Fixed URL building in APITool.java. Updated libraries for API, Launcher. Started applying NotNull annotation to methods and arguments in Core.java. Started handeling the big init block in Core.java. Added overloaded constructor for Core.java and made Core.ollamaIP a variabled that's definible Updated Tool.addTool return for 400 error.
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import socket
|
||||
import json
|
||||
import builtins
|
||||
|
||||
HOST = "host.docker.internal"
|
||||
PORT = 6050
|
||||
|
||||
def connect(data):
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
s.connect((HOST, PORT))
|
||||
data = data + "\n"
|
||||
s.sendall(data.encode("utf-8"))
|
||||
responce = s.recv(4096)
|
||||
return responce.decode("utf-8")
|
||||
|
||||
def print_output(text):
|
||||
data = {"function": "print_output", "arguments": [{"name": "text", "value": text}]}
|
||||
connect(json.dumps(data))
|
||||
|
||||
def _neurodock_print(*args, **kwargs):
|
||||
text = " ".join(str(a) for a in args)
|
||||
print_output(text)
|
||||
|
||||
builtins.print = _neurodock_print
|
||||
Reference in New Issue
Block a user