- Notifications
You must be signed in to change notification settings - Fork0
This application is a Chatbot that uses the OpenAI API to maintain a conversation, it has an interface similar to ChatGPT itself
License
Sup3r-Us3r/chatbot-app
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This application is a Chatbot that uses the OpenAI API to maintain a conversation, it has an interface similar to ChatGPT itself.
chatbot-demo.mov
Chat Front-end
- Next.js
- BFF (Route Handlers)
- SES
- gRPC Client
- MySQL
- Prisma
- SWR
- Next Auth
- Keycloak
- Tailwindcss
- Docker + Docker Compose
Chat Microservice
- Golang
- MySQL
- SQLC
- Go Chi
- Go OpenAI
- gRPC Server Stream
- REST API
- Docker + Docker Compose
Access the folder:
$cd chat-service
Create.env
file:
$ cp .env.example .env
Update the variable values as needed.
Create OpenAI Secret Key and update the variable below:
OPENAI_API_KEY="PASTE THE OPENAI SECRET KEY VALUE"
Access the folder:
$cd chat
Create.env
file:
$ cp .env.example .env
Update the variable values as needed.
Configure/etc/hosts
:
# Mac and Linux# /etc/hosts# Windows# C:\Windows\System32\drivers\etc\hosts127.0.0.1 host.docker.internal
Keycloak settings
Access Keycloak Administration Console
Username: admin
Password: admin
http://host.docker.internal:9000
Create Realm:
Realm name: chat-app
Enabled: yes
Create User:
This user will be used for you to access app, so define as you wish the name, email, etc.
After create user, go to
Credentials
tab and set a new password, unchecked temporary option.
Create Client:
ClientID: nextjs
Valid redirect URIs:http://localhost:3000/*
Web origins:http://localhost:3000/*
Client authentication: On
Authentication flow: Standard flow and Direct access grants
After create client, go toCredentials
tab and copyClient secret
value and add in the.env
file:
KEYCLOAK_CLIENT_SECRET="PASTE THE CLIENT SECRET VALUE"
Up Container:
$ docker-compose up -d
Access container:
$ dockerexec -it chatservice_app /bin/bash
Install dependencies:
$ go mod tidy
Run migrations:
$ make migrate
Run microservice:
$ go run cmd/chatservice/main.go
Up Container:
$ docker-compose up -d
Access container:
$ dockerexec -it chat_app /bin/bash
Install dependencies:
$ npm install
Run migrations:
$ npx prisma migrate dev
Run front-end:
$ npm run dev