Files
NeuroDock/Display/src/main/resources/external_tool_base.py
T
Zacharias d016ad9a48
build / build (push) Has been cancelled
refactor(Core): decompose handleResponse and add ToolCallingRender system
- Extract handleResponse into focused helpers: processToolCall, findTool,
  reportToolNotFound, renderToolCalling, executeToolCall
- Introduce ToolCallingRender sealed interface (Suppress/Default/Custom)
  allowing tools to control how their invocations are rendered
- Add printToolCalling to PrintAdvanceMessageHandler contract
- Implement default tool calling rendering in PrintMessageHandler (blue text)
- Add WriteFileTool for file writing capabilities
- Fix "responce" → "response" typo across Java and Python files
- Improve PythonRunner docker error handling and output messages
- Update Gradle test configuration (maxHeapSize, test logging)

Signed-off-by: zacharias <alienfromdia@proton.me>
2026-06-15 14:55:09 +02:00

26 lines
650 B
Python

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"))
response = s.recv(4096)
return response.decode("utf-8")
def print_output(text):
data = {"function": "print_output", "container_id": CONTAINER_ID, "text": 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
## Following is the generated