Coder Social home page Coder Social logo

thatdudejbob / chatgpt-react-application Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ioanmo226/chatgpt-react-application

0.0 0.0 0.0 4.03 MB

A web application that allows users to interact with OpenAI's GPT-3 language model through a simple and user-friendly interface.

License: MIT License

Shell 0.25% JavaScript 11.59% TypeScript 57.61% CSS 20.66% HTML 9.90%

chatgpt-react-application's Introduction

ChatGPT Web Application

A web application that allows users to interact with OpenAI's GPT-3 language model through a simple and user-friendly interface. This app is for demo purpose to test OpenAI API and may contain issues/bugs.

If you are looking for a simple HTML/vanilla JavaScript version, check here

Demo Gif

Buy Me A Coffee

Features

  • User-friendly interface for making requests to the OpenAI API
  • Responses are displayed in a chat-like format
  • Select Models (Davinci, Codex, Create Image) based on your needs
  • Highlight code syntax

Technologies Used

  • For client, I used React.js.
  • For server, I used express.

Setup Introduction

This guide will help you set up the repository on your local machine. Please follow these steps carefully to ensure a smooth setup process.

Cloning the repository

Use the following command to clone the repository:

git clone https://github.com/ioanmo226/chatgpt-web-application

Backend Setup

  • Navigate to server directory
cd server # Navigate to the server directory:
  • Install dependencies
npm install #install the backend dependencies
  • Set the OPENAI_API_KEY in the .env file:
OPENAI_API_KEY=YOUR_OPENAI_API_KEY
  • Start the backend server by running the following command:
node index.js

Frontend Setup

  • Navigate to the client directory:
cd client
  • Run the following command to install the frontend dependencies:
npm install
  • Set the REACT_APP_BACKEND_URL in the .env file to the URL of your backend server. For local development, use the following URL:
REACT_APP_BACKEND_URL=http://localhost:3001/
  • Start the frontend app by running the following command:
npm start

Hosting Backend and Frontend in Same Port/URL

If you wish to host both the backend and frontend on the same port/URL, follow these steps:

  • Build the frontend by running the following command in the client directory:
npm run build
  • Copy the build directory to the server directory and rename it to frontend.

  • Start the backend server using the instructions in the "Backend Setup" section.

  • Once the setup process is complete, the frontend will be accessible at the URL of your backend server.

Usage

  • Type in the input field and press enter or click on the send button to make a request to the OpenAI API
  • Use control+enter to add line breaks in the input field
  • Responses are displayed in the chat-like format on top of the page
  • Generate code, including translating natural language to code
  • You can also create AI images using DALL·E models

Contributing

This project welcomes contributions and suggestions for improvements. If you have any ideas, please feel free to open an issue or create a pull request.

Thank you for your consideration.

chatgpt-react-application's People

Contributors

ioanmo226 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.