This repository contains a Node.js terminal application designed to facilitate interactive conversations using OpenAI's GPT-4-turbo. It leverages the OpenAI API to create dynamic and intelligent responses based on user input, maintaining a conversational history to provide context for each interaction.
- Dynamic Conversation Handling: Utilizes OpenAI's GPT-4-turbo model for generating responses, streamed in chunks for real-time interaction.
- [beta] Image Generation: The chatbot can generate images using the OpenAI API.
- Persistent History: Conversations are stored and managed, allowing for context-aware interactions.
- Terminal Interface: Simple and intuitive console-based interface for easy interaction.
- Easy History Reset: A simple command to reset the conversation history and start a new conversation. Without deleting the system message.
- Customizable Responses: Easily adaptable script for personalized conversation flows.
- Privacy-Focused: Instructions are provided to ensure conversation data is kept local and private.
- Node.js installed on your machine.
- An OpenAI API key.
- Clone the repository to your local machine.
- Install the necessary dependencies by running
npm install. - Create a
.envfile at the root of your project and add your OpenAI API key asOPENAI_API_KEY=<Your-API-Key>. - Manually create a file named
memory.jsonin the root directory of your project. This file should contain an array with an initialsystemobject, for example:[{"role": "system", "content": "Your system message"}]. This file is used to locally store the conversation history. - Add
memory.jsonto your.gitignoreto ensure privacy and data protection, as this file may contain personal conversation histories.
Execute node chat.js to start the chatbot. Engage in a conversation by typing your messages into the console.
Contributions are welcome! Please feel free to submit a pull request or create an issue for any bugs or enhancements.
This project is licensed under the MIT License - see the LICENSE file for details.