ChatGPT GUI is a user-friendly desktop application that allows you to interact effortlessly with OpenAI's ChatGPT model.
- Features
- Demo
- Installation
- Configuration
- Usage
- Session Management
- Exporting Chats
- Logging
- Contributing
- License
- Acknowledgments
- Interactive Chat Interface: Engage in real-time conversations with ChatGPT.
- Session Management: Save, load, and manage multiple chat sessions.
- Rate Limiting: Implements a token bucket algorithm to adhere to OpenAI's API rate limits.
- Markdown Export: Export your conversations as Markdown files for easy sharing and archiving.
- Code Block Formatting: Supports formatted code blocks within the chat for enhanced readability.
- System Tray Integration: Minimize the application to the system tray for easy access.
- Graceful Shutdown: Ensures sessions are saved upon exiting the application.
- Comprehensive Logging: Logs important events and errors for monitoring and debugging.
Screenshot of the ChatGPT GUI application in action.
Follow these steps to set up the ChatGPT GUI on your local machine.
- Python 3.8 or higher: Ensure you have Python installed. You can download it from python.org.
-
Clone the Repository
Use the following command to clone the repository and navigate into the project directory:
git clone https://github.com/yourusername/chatgpt-gui.git
cd chatgpt-gui -
Create a Virtual Environment
It's recommended to use a virtual environment to manage dependencies:
python -m venv venv -
Activate the Virtual Environment
-
Windows:
venv\Scripts\activate -
macOS and Linux:
source venv/bin/activate
-
-
Install Dependencies
Install the required dependencies using pip:
pip install -r requirements.txtIf
requirements.txtis not provided, install dependencies manually:pip install PyQt5 openai tiktoken python-dotenv tenacity -
Set Up Environment Variables
Create a
.envfile in the root directory of the project and add your OpenAI API key:OPENAI_API_KEY=your_openai_api_key_hereEnsure that you replace
your_openai_api_key_herewith your actual OpenAI API key.
The application uses a Token Bucket algorithm to manage API request rates, preventing exceeding OpenAI's rate limits.
-
Parameters:
rate_limit_max_calls: Maximum number of API calls allowed within the period.rate_limit_period: Time period (in seconds) for the rate limit.
-
Default Settings:
handler = ChatGPTHandler(rate_limit_max_calls=60, rate_limit_period=60.0)This configuration allows 60 API calls per 60 seconds.
-
Adjusting Rate Limits:
Modify these parameters based on your OpenAI subscription plan's rate limits.
By default, the application uses the "o1-preview" model with a high token limit. You can adjust the model and token limits in the ChatGPTHandler initialization:
handler = ChatGPTHandler( model="o1-preview", max_context_tokens=128000, max_response_tokens=32768, rate_limit_max_calls=60, rate_limit_period=60.0 )
Ensure that the model and token limits align with your OpenAI subscription and usage requirements.
Launch the application using the following command:
python main_gui.py
Ensure that your virtual environment is activated before running the command.
- Type Your Message: Enter your query or message in the input field at the bottom of the application window.
- Send Message: Click the Send button or press Enter to submit your message.
- View Response: ChatGPT's response will appear in the chat area above.
Manage your chat sessions with ease.
- Navigate to the File menu.
- Select Save Session.
- Choose a location and filename to save your current session as a JSON file.
- Navigate to the File menu.
- Select Load Session.
- Browse and select a previously saved session JSON file to load your chat history.
Export your conversations for sharing or archival purposes.
- Navigate to the File menu.
- Select Export Chat as Markdown.
- Choose a destination and filename to save your chat history as a Markdown (
.md) file.
All significant events and errors are logged to chatgpt_handler.log in the root directory. This log file is invaluable for monitoring application behavior and debugging issues.
Contributions are welcome! To contribute to ChatGPT GUI, please follow these guidelines:
-
Fork the Repository
Click the Fork button at the top-right corner of the repository page.
-
Create a New Branch
git checkout -b feature/YourFeatureName -
Make Your Changes
Implement your feature or bug fix.
-
Commit Your Changes
git commit -m "Add some feature" -
Push to the Branch
git push origin feature/YourFeatureName -
Open a Pull Request
Navigate to the original repository and click Compare & pull request.
Please adhere to the Code of Conduct when contributing to this project.
This project is licensed under the MIT License.
- PyQt5: For providing the GUI framework.
- OpenAI: For the powerful ChatGPT API.
- tiktoken: For efficient tokenization.
- Tenacity: For robust retry mechanisms.
- python-dotenv: For managing environment variables.
Developed by dagnazty.
