This repository contains a simple personal chatbot built using OpenAI's GPT-3.5-turbo model and Gradio for the user interface. The chatbot allows for interactive conversations and saves the conversation history to a text file.
- Interactive Chat: Engage in conversations with the chatbot using OpenAI's language model.
- Conversation History: Automatically saves the conversation history in a text file.
- Customizable UI: Simple user interface built with Gradio.
- Python 3.7+
- Install the required packages:
pip install openai gradio
-
OpenAI API Setup:
Replace"add base"
with your OpenAI API base URL and"add your key"
with your OpenAI API key in the script.openai.api_base = "https://api.openai.com/v1" openai.api_key = "your-api-key"
-
Run the Chatbot:
python your_script.py
Replace
your_script.py
with the filename of your Python script.
- Message Handling: The chatbot saves the first message as the filename (limited to the first 20 characters) to store the conversation.
- Conversation Logging: Each message and its corresponding response are logged in a text file named after the first message.
- Launch the chatbot UI:
- After running the script, a Gradio UI will open in your browser where you can start chatting with the bot.
- The chat history is displayed, and you can interact by typing messages.
- Start a conversation: Type your message in the textbox and click "Send."
- View conversation history: The conversation history is stored in a
.txt
file with the filename based on the first message you typed.