Skip to content

Commit af4c922

Browse files
committed
Server docker image
1 parent 7f034ad commit af4c922

File tree

2 files changed

+33
-5
lines changed

2 files changed

+33
-5
lines changed

Dockerfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
###########################################################################################
2+
# This Dockerfile runs an LMC-compatible websocket server at / on port 8000. #
3+
# To learn more about LMC, visit https://docs.openinterpreter.com/protocols/lmc-messages. #
4+
###########################################################################################
5+
6+
FROM python:3.11.8
7+
8+
# Set environment variables
9+
# ENV OPENAI_API_KEY ...
10+
11+
# Copy required files into container
12+
RUN mkdir -p interpreter
13+
COPY interpreter/ interpreter/
14+
COPY poetry.lock pyproject.toml README.md ./
15+
16+
# Expose port 8000
17+
EXPOSE 8000
18+
19+
# Install server dependencies
20+
RUN pip install -e ".[server]"
21+
22+
# Start the server
23+
ENTRYPOINT ["interpreter", "--server"]

interpreter/terminal_interface/start_terminal_interface.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
contribute_conversations,
1010
)
1111

12-
from ..core.core import OpenInterpreter
1312
from .conversation_navigator import conversation_navigator
1413
from .profiles.profiles import open_storage_dir, profile, reset_profile
1514
from .utils.check_for_update import check_for_update
@@ -320,6 +319,12 @@ def start_terminal_interface(interpreter):
320319

321320
args, unknown_args = parser.parse_known_args()
322321

322+
if args.server:
323+
# Instead use an async interpreter, which has a server. Set settings on that
324+
from interpreter import AsyncInterpreter
325+
326+
interpreter = AsyncInterpreter()
327+
323328
# handle unknown arguments
324329
if unknown_args:
325330
print(f"\nUnrecognized argument(s): {unknown_args}")
@@ -471,14 +476,14 @@ def start_terminal_interface(interpreter):
471476
conversation_navigator(interpreter)
472477
return
473478

474-
if args.server:
475-
interpreter.server()
476-
return
477-
478479
validate_llm_settings(
479480
interpreter
480481
) # This should actually just run interpreter.llm.load() once that's == to validate_llm_settings
481482

483+
if args.server:
484+
interpreter.server.run()
485+
return
486+
482487
interpreter.in_terminal_interface = True
483488

484489
contribute_conversation_launch_logic(interpreter)

0 commit comments

Comments
 (0)