Skip to content

modecode22/chatgpt-arabic-next13-app

Repository files navigation

Chat App with OpenAI API

This is a simple chat application that uses the OpenAI API, Next.js, SWR, TypeScript, Next Auth , and Firebase. The purpose of this application is to showcase how to use the OpenAI API to build a simple chat application.

Installation

To install and run the project, please follow these steps:

  1. Clone the repository.
  2. Run npm install to install the required packages.
  3. In the src folder create firebase.ts file:
// Import the functions you need from the SDKs you need
import { getApp, getApps, initializeApp } from "firebase/app";
import { getFirestore } from 'firebase/firestore'

// Your web app's Firebase configuration
const firebaseConfig = {
   // Add your own Firebase configuration details here
};

// Initialize Firebase
const app = getApps().length ? getApp() : initializeApp(firebaseConfig);

// Get a reference to the Firestore database
const db = getFirestore(app);

// Export the Firestore database reference
export { db };
  1. Add your OpenAI API key to the .env.local file. Example:

OPENAI_API_KEY=YOUR_API_KEY

  1. Run npm run dev to start the development server.

Usage

To use the application, simply login click "+". You can then send messages and receive responses generated by the OpenAI API. The application also supports real-time updates.

Contribution

If you would like to contribute to this project, please feel free to fork the repository and submit a pull request. We welcome all contributions, big and small!

Acknowledgements

This project was created by modecode22 to showcase the use of the OpenAI API. We would like to thank the OpenAI team for providing such a powerful tool, as well as the creators of Next.js, SWR, TypeScript, and Firebase for their amazing work.