Skip to content

viodid/chatbot-openAI

Repository files navigation

Chatbot using OpenAI API and Flask

This project is a chatbot implementation using the OpenAI API for natural language processing and the Flask framework in Python for the backend. The communication between the client and server is facilitated through websockets using the Socket.IO library.

The chatbot's user interface (UI) is inspired by a CodePen design.

Project Structure

The project follows the following directory structure:

Getting Started

To run the chatbot locally, follow these steps:

  1. Clone the repository: git clone https://github.com/your-username/chatbot.git
  2. Install the required dependencies: pip install -r requirements.txt
  3. Start the server: python run.py
  4. Open your web browser and go to http://localhost:8888 to access the chatbot UI.

Configuration

The config.py file contains configuration parameters for the chatbot. You may modify this file to customize the behavior of the chatbot, such as setting the API keys for the OpenAI API or adjusting other settings.

Usage

Once the chatbot is running, users can interact with it through the web interface. Messages are sent to the server via websockets, and the Flask backend processes the user input using the OpenAI API to generate appropriate responses.

Deploying with Docker

You can also deploy the chatbot using Docker. A Dockerfile is provided for easy deployment. Follow these steps to deploy the chatbot using Docker:

  1. Build the Docker image: docker build -t chatbot-app .
  2. Run the Docker container: docker run -p 8888:8888 chatbot-app

The chatbot will be accessible at http://localhost:8888 just like when running locally.

Documentation

Here are some helpful links for the documentation:

The provided links will help you understand and utilize the technologies and tools used in this project, including Flask-SocketIO for server side WebSocket communication and Socket.IO for client side WebSocket communication.

License

This project is licensed under the Unlicense - a public domain dedication.

You are free to use, modify, and distribute the code in any way you see fit without any restrictions. The Unlicense allows you to do whatever you want with the code, including using it for commercial purposes, without requiring any attribution or permission from the original author.

The Unlicense is a permissive license that grants you the maximum freedom to use the software without imposing any legal obligations or limitations.

For more details, please refer to the Unlicense website.

Feel free to make this project your own and use it for any purpose you desire.

Acknowledgments

The chatbot UI design is based on a CodePen design created by Zenworm, which can be found at source.

Contributing

Contributions to this project are welcome. If you find any issues or have improvements to suggest, please feel free to submit a pull request.

Contact

Hey there! I'm excited that you're exploring my chatbot project. If you have any questions, feedback, or just want to say hi, feel free to get in touch with me!

I'm always happy to chat about anything related to this project, and I'm open to suggestions for improvements or new features. Your input is valuable, and it helps make this chatbot even better.

You can reach out to me through any of the following channels:

Don't hesitate to contact me if you have any questions, run into issues, or just want to share your experience with the chatbot. I'm looking forward to hearing from you!