AineeJames / ChatGPTerminator

GPTerminator provides a convenient way to interact with OpenAI's chat completion and image generation API's using your command line interface.
MIT License
230 stars 16 forks source link

Won't work with containerization #6

Closed webgtx closed 1 year ago

webgtx commented 1 year ago

Well, I'm trying to build container image. And I stuck with this python error, this stderr appears when I'm running your script in container.

STDERR

?main ~/Desktop/devroom/ChatGPTerminator> podman run -it --name gpterm gpterm  
Traceback (most recent call last):
  File "/usr/local/bin/gpterm", line 5, in <module>
    from gpterminator.__main__ import main
  File "/usr/local/lib/python3.9/site-packages/gpterminator/__main__.py", line 1, in <module>
    from . import GPTerminator
  File "/usr/local/lib/python3.9/site-packages/gpterminator/GPTerminator.py", line 168
    match msg["role"]:
          ^
SyntaxError: invalid syntax
exit 1

Dockerfile

FROM python:3.9-alpine
WORKDIR /root
COPY . .
RUN mkdir -p /root/.config/gpterminator
RUN pip install . 
ARG APIKEY
ENV OPENAI_API_KEY=$APIKEY
CMD ["gpterm"]
AineeJames commented 1 year ago

Match case was introduced in Python 3.10, try updating and trying again!

AineeJames commented 1 year ago

I just released a new version that uses if else instead of match case, so you should be able to run it now!

webgtx commented 1 year ago

Alright, I'll check soon

webgtx commented 1 year ago

Everything is fine