Skip to content

Guusy/a-gptchat

Repository files navigation

GPT Chat

A clone of the ChatGPT UI.

Getting Started

Docker Compose

The Docker Compose setup includes PostgreSQL, Redis, and pgAdmin. Run the following command to start everything:

docker-compose up -d

Environment Variables

Copy .env.example to a .env file and fill it with your credentials.

AI Integration

If you want to mock the AI integration, make sure to set the STUB_AI="true" environment variable. Otherwise, it will try to connect to OpenAI.

Auth

This repository uses next-auth to handle login with Google SSO. You need to create your credentials. Check the Google Docs for more information.

Redis

We use Redis to handle the users allowed to log in to the platform. Set up the REDIS_URL environment variable with your local Redis instance.

Since this app only allows specific emails to log in, you will need to connect to the Redis instance and add these emails to a specific key.

Connect to the Docker instance:

redis-cli -h localhost -p 6379

Add a user:

SADD allowed_users "[email protected]"

Check the set of allowed users:

    SMEMBERS allowed_users

Run the Server

Install dependencies

    npm install

If you have all the environment variables in place, create a schema and run the database migrations:

npm run db:migrate

Run the development server:

npm run dev

Open http://localhost:3000 in your browser to see the result.

Test E2E

Make sure you have your local server running.

Run in Debug Mode
npm run test:e2e:open
Run in Headless Mode
npm run test:e2e

TODOS

  • Use the event stream OpenAI API to improve the UX and response time, instead of a normal HTTP request.

  • Change the flow of new chat. We should create a chat with the initial message (user), redirect to the chat/:id, and then send the message to the AI. This new flow will improve the UX because the user will not need to wait for the entire response of the AI to change the view.

About

A chatgpt clone

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published