A simple JavaScript OpenAI application that allows you to chat with OpenAI. It supports a very rudimentary form of memory management, and the conversation history is encrypted and stored in the browser's local storage.
- Real-time chat interface with AI responses
- Chat history management with basic encryption
- Markdown support for rich text formatting
- Memory feature for context-aware conversations
- Customizable settings (API key, system prompt, bot name, user name)
- Debug mode for development
- Dark mode toggle
- Modern web browser
- OpenAI API key (for AI functionality)
-
Clone the repository:
git clone https://github.com/rb81/openai-js-chat.git
-
Navigate to the project directory:
cd openai-js-chat
-
To run the application properly and allow it to make API calls, you need to serve it from a local HTTP server instead of opening it directly as a file. You can use the included
server.py
script for this purpose.python server.py
- Open the settings panel in the application.
- Enter your OpenAI API key.
- Customize other settings as desired (system prompt, bot name, user name, etc.).
- Type your message in the input field and press Enter or click the send button.
- The AI will respond based on the conversation context and your settings.
- Use the settings panel to adjust application behavior.
To run the application in debug mode, append ?debug=true
to the URL. Detailed logging will be displayed in the browser's console.
src/js/main-app.js
: Main application logicsrc/js/ui-module.js
: User interface managementsrc/js/api-module.js
: OpenAI API interactionsrc/js/settings-module.js
: Settings managementsrc/js/chat-history-module.js
: Chat history handlingsrc/js/encryption-utils.js
: Data encryption utilitiessrc/js/debug-utils.js
: Debugging utilities
- Markdown-it for Markdown rendering
This application uses OpenAI's API, which may have usage costs. Please be aware of OpenAI's pricing and terms of service when using this application.
This project is licensed under the MIT License - see the LICENSE file for details.
ai.collaboratedwith.me in creating this project.