Skip to content
/ ai-chat Public

Simple chat application using Open AI and Groq SDK.

Notifications You must be signed in to change notification settings

nljms/ai-chat

Repository files navigation

Simple Chat

A simple chat fullstack web application using Open AI built with React and Node JS.

Prerequisites

Make sure you have installed the following on your machine:

  • Node (at least v18+ or higher)
# install node link: https://nodejs.org/en/download/package-manager
# On a Mac use the following command

# installs nvm (Node Version Manager)
curl -o- https://github.com/raw/nvm-sh/nvm/v0.39.7/install.sh | bash

# download and install Node.js (you may need to restart the terminal)
nvm install 18

# verifies the right Node.js version is in the environment
node -v # should print `v18.20.3`

# verifies the right NPM version is in the environment
npm -v # should print `10.7.0`

Note: if you aren't using Mac, the link above 👆🏽 provides you various ways to install node on your machine

  • pnpm - is the package manager used in this project
  • bit cli
npx @teambit/bvm install
# you need to reload your bash profile to be able to access

What's inside?

This project used @teambit/bvm (bit) for bootstrapping the monorepo. You can read more about this tool on their documentation page

Up and running

  • Add environment variables
# Add .env at the root folder
OPENAI_API_KEY=xxx
GROQ_API_KEY=xxx
  • Install dependencies
bit install
  • Check if the apps are listed
bit app list # should show 2 apps (chat-ui and chat-service)
  • Run compose file
docker-compose up # -d (dettached mode)
# turn off services
docker-compose down
  • Run the application
# backend
bit run chat-service
# frontend
bit run chat-ui

Note: Whenever the backend service doesn't compile, try to run bit install && bit run chat-service to recompile the service. Then afterwards restart the frontend as well.

Demo

This is how it currently works.

First iteration Current
Screen.Recording.2024-06-24.at.00.57.39.mov
Screen.Recording.2024-06-26.at.02.27.16.mov