Code Monkey home page Code Monkey logo

chatbot's Introduction

Chat Bot Project ๐Ÿค–๐ŸŽ™๏ธ

Welcome to the Chat Bot project! This initiative is a simple hobby project designed to explore the capabilities of the OpenAI API for speech-to-text and text-to-speech conversion, along with the code generation capabilities of ChatGPT.

This project enables you to engage in conversations with an OpenAI assistant using your voice and receive spoken responses. It offers a basic web interface for recording and playing audio, enhancing the experience by converting the recorded speech to text through OpenAI.

The majority of the code is AI-generated by ChatGPT, with minor tweaks incorporated here and there.

Introduction

The primary goals of this project include:

  • Recording voice using the browser's Web Audio API.
  • Utilizing the OpenAI API for speech-to-text conversion.
  • Generating a response from an OpenAI assistant to be played back as audio.
  • Experimenting with text-to-speech using the OpenAI API.

Please note that this project is purely for educational and recreational purposes, and its primary intention is to provide a hands-on experience with the OpenAI API. It's a great starting point for those interested in exploring voice-related functionalities and experimenting with API integrations, but not intended for commercial use.

Getting Started

To get started with the project, follow these steps:

Prerequisites

  1. OpenAI API Key: Obtain an API key from OpenAI. You can sign up for an API key on the OpenAI platform.

Installation

  1. Clone the Repository:

    git clone https://github.com/danielksb/chatbot.git
  2. Navigate to the Project Directory:

    cd chatbot
  3. Install Dependencies:

    npm install

Configuration

  1. Set OpenAI API Key:
    • Set the environment variable OPENAI_API_KEY to your actual OpenAI API key.

Run the Application

  1. Start the Server:

    npm start
  2. Access the Application: Open your web browser and go to http://localhost:3000.

Project Structure

Frontend

The frontend code is located in the static directory. It contains the HTML, CSS, and JavaScript files responsible for the user interface and interactions.

Backend

The backend code is primarily written in Express.js and can be found in the main.js file. This file handles server setup, routing, and interaction with the OpenAI API.

Usage

  1. Record Audio:

    • Click the "Record" button to initiate voice recording.
    • Click the "Stop" button to conclude the recording.
  2. Have a Chat with GPT:

    • Automatically convert the recorded speech to text using the OpenAI API.
    • Transmit the text as a message to a preconfigured assistant (currently hardcoded in the backend).
    • Upon the assistant's response, an audio file will be generated and played.
    • Click the "Play" button to replay the recorded audio.
  3. Explore and Experiment:

    • Feel free to customize and expand the project according to your interests.
    • Experiment with various voices and features provided by the OpenAI API.

License

This project is licensed under the GNU Affero GPL.

Happy coding! ๐Ÿš€

chatbot's People

Contributors

danielksb avatar

Watchers

 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.