Skip to content

Commit 8a553ed

Browse files
committed
Server fixes
1 parent 9a2d085 commit 8a553ed

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

interpreter/core/async_core.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -310,30 +310,21 @@ def __init__(self, async_interpreter, host=host, port=port):
310310
self.app.include_router(router)
311311
self.host = host
312312
self.port = port
313-
self.uvicorn_server = uvicorn.Server(
314-
config=uvicorn.Config(app=self.app, host=self.host, port=self.port)
315-
)
316313

317314
def run(self, retries=5, *args, **kwargs):
318315
print("SERVER STARTING")
319316

320317
if "host" in kwargs:
321-
host = kwargs["host"]
322-
else:
323-
host = self.host
318+
self.host = kwargs["host"]
324319

325-
if host == "0.0.0.0":
326-
print(
327-
"Warning: Using host `0.0.0.0` will expose Open Interpreter over your local network."
328-
)
329-
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
330-
s.connect(("8.8.8.8", 80)) # Google's public DNS server
331-
print(f"Server is running at http://{s.getsockname()[0]}:{self.port}")
332-
s.close()
320+
if "port" in kwargs:
321+
self.port = kwargs["port"]
333322

334323
for _ in range(retries):
335324
try:
336-
self.uvicorn_server.run(*args, **kwargs)
325+
uvicorn.run(
326+
app=self.app, host=self.host, port=self.port, *args, **kwargs
327+
)
337328
break
338329
except KeyboardInterrupt:
339330
break

0 commit comments

Comments
 (0)