Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

feat: use official api key solution #35

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@
EMAIL=
# Require
PASSWORD=
# Session Token
SESSION_TOKEN=
REVERSE_PROXY_URL=
# Optional Are you a Plus user?
IS_PRO_ACCOUNT=false
# Optional (if you dont understand, please dont change)
MARKDOWN=false
DEBUG=false
IS_GOOGLE_LOGIN=false
IS_MICROSOFT_LOGIN=false
MINIMIZE=false
CAPTCHA_TOKEN=
NOPECHA_KEY=
EXECUTABLE_PATH=
PROXY_SERVER=
USER_DATA_DIR=
# API KEY
API_KEY=
REVERSE_PROXY_URL=
6 changes: 6 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
image:
file: .gitpod.Dockerfile

tasks:
- init: nvm i 18 && npm install && cp .env.example .env && npx prisma migrate deploy
command: npm run dev
13 changes: 4 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
FROM node:19
FROM node:20
WORKDIR /app
# We don't need the standalone Chromium
RUN apt-get install -y wget \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list \
&& apt-get update && apt-get -y install google-chrome-stable chromium xvfb\
&& rm -rf /var/lib/apt/lists/* \
&& echo "Chrome: " && google-chrome --version
COPY package.json .
COPY package-lock.json .

RUN npm config set update-notifier false
RUN npm install
COPY . .
RUN npm run build
EXPOSE 4000
CMD npx prisma migrate deploy && xvfb-run --server-args="-screen 0 1280x800x24 -ac -nolisten tcp -dpi 96 +extension RANDR -maxclients 2048" node dist/index.js
CMD npx prisma migrate deploy && node dist/index.js
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ docker run -d --name chatgpt-api-single -e EMAIL=<YourOpenAIAccount> -e PASSWORD
# See log
docker logs -f chatgpt-api-single
```

For how generate session, all you need is your access token from https://chat.openai.com/api/auth/session
```sh
docker run -d --name chatgpt-api-single -e API_KEY=<YourSesstion> -p 4000:4000 -v $PWD/data:/app/data ghcr.io/bytemate/chatapi-single:main
```
## Config

```sh
Expand Down Expand Up @@ -71,7 +76,12 @@ curl -X "POST" "http://localhost:4000/message" \
curl -X "POST" "http://localhost:4000/message/holegots" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"message": "Hello"
"message": "Write a short poem about cats."
}'
curl -X "POST" "http://localhost:4000/message/holegots" \
-H 'Content-Type: application/json; charset=utf-8' \
-d $'{
"message": "rewrite it in Chinise"
}'
```

Expand Down
Loading