Headless mode to run in docker
Is there a way to set up the authentication such that it can be ran inside a docker container?
I'd like to know this too!
This could be a bit challenging. There are a few ways to approach this:
- Automating authentication: There are services that can automate the filling of captchas, allowing for seamless authentication.
- Using cookies from a previous session as parameters when starting the script: You can start the script locally, export the cookies, and then use them as parameters when starting the script in a Docker container. This would involve two steps: first, starting the script locally and exporting the cookies, and then starting the Docker container with the local parameters.
Both cases require some involved modifications to the script. If you tackle this, I would welcome any PR (no worries if the code is not clean, I can help improving it).
You could do it like this:
- Set your session location (
user_dirfrom https://github.com/mmabrouk/chatgpt-wrapper/blob/main/chatgpt_wrapper/chatgpt.py#L50) to be shared using a docker volume - Run wrapper and log in locally
- Start the docker container, using the same state from above
This isn't a perfect solution as you still need to detect session time out. But I can't think of a better way to feasibly do this.
This would probably need somebody to make a PR, or sponsorship.
Since the browser backend has been deprecated, the Docker container has been changed to leverage the API backed, and authentication is handled via API key.