A powerful WordPress plugin that enables AI-powered chat support using PDF documents stored in Pinecone vector database for intelligent document retrieval and automated customer responses.
- PDF Document Upload: Drag-and-drop interface for uploading PDF files
- AI-Powered Chat: Intelligent responses based on document content
- Vector Search: Pinecone integration for semantic document search
- Real-time Chat Widget: Modern, responsive chat interface
- Multi-language Support: Ready for internationalization
- Mobile Responsive: Works seamlessly on all devices
- Comprehensive Dashboard: Analytics and conversation management
- API Configuration: Easy setup for Pinecone and OpenAI
- Document Management: Upload, process, and manage PDF files
- Chat Customization: Customize widget appearance and behavior
- Rate Limiting: Built-in protection against abuse
- Connection Testing: Verify API connections before going live
- Floating Chat Widget: Unobtrusive, always-accessible chat
- Source Citations: Show which documents answers come from
- Typing Indicators: Real-time conversation feedback
- Message History: Persistent conversation tracking
- Error Handling: Graceful fallbacks for various scenarios
- Accessibility: WCAG 2.1 AA compliant
- WordPress 5.0 or higher
- PHP 7.4 or higher
- MySQL 5.6 or higher
- Pinecone API account
- OpenAI API account
-
Download the Plugin
git clone https://github.com/bhavik-dreamz/pdf-chat-support-for-wordpress.git cd pdf-chat-support-for-wordpress -
Upload to WordPress
- Upload the
pdf-chat-supportfolder to/wp-content/plugins/ - Or upload the zip file through WordPress admin
- Upload the
-
Activate the Plugin
- Go to WordPress Admin > Plugins
- Find "PDF Chat Support" and click "Activate"
-
Configure APIs
- Go to Settings > PDF Chat Support
- Enter your Pinecone and OpenAI API keys
- Test the connections
- Create a Pinecone account at pinecone.io
- Create a new index with these settings:
- Dimensions: 1536
- Metric: Cosine
- Index Name: pdf-chat-support (or your preferred name)
- Copy your API key and environment details
- Create an OpenAI account at openai.com
- Generate an API key in your account settings
- Ensure you have credits available for API usage
-
Navigate to Settings
- WordPress Admin > Settings > PDF Chat Support
-
API Configuration Tab
- Enter Pinecone API Key
- Enter OpenAI API Key
- Test both connections
-
General Settings Tab
- Enable/disable chat widget
- Choose widget position
- Set widget color
- Customize welcome message
-
Chat Configuration Tab
- Set maximum response tokens (default: 500)
- Adjust similarity threshold (default: 0.7)
- Configure rate limiting (default: 60 requests/hour)
-
PDF Management Tab
- Upload your PDF documents
- Monitor processing status
- Manage uploaded files
- Go to PDF Management tab in plugin settings
- Drag and drop PDF files or click "Select Files"
- Wait for processing to complete
- Documents will be automatically chunked and stored in Pinecone
The chat widget automatically appears on your frontend when enabled. Users can:
- Click the chat icon to open the conversation
- Type questions about your uploaded documents
- Receive AI-powered responses with source citations
- View conversation history within the session
Monitor your chat performance in the Analytics tab:
- Total conversations and messages
- Active conversation count
- Document utilization metrics
- Recent conversation overview
The plugin uses CSS custom properties for easy customization:
:root {
--widget-color: #your-brand-color;
--widget-color-hover: #your-hover-color;
--widget-text-color: #ffffff;
}// Control when to display the chat widget
add_filter('pdf_chat_support_display_widget', function($display) {
// Your logic here
return $display;
});
// Modify the system prompt for AI responses
add_filter('pdf_chat_support_system_prompt', function($prompt, $context) {
// Customize the AI behavior
return $modified_prompt;
}, 10, 2);// Hook into document processing
add_action('pdf_chat_support_document_processed', function($document_id) {
// Your code here
});
// Hook into chat message events
add_action('pdf_chat_support_message_sent', function($message_data) {
// Your code here
});- All API keys are stored encrypted
- User messages are sanitized before processing
- Rate limiting prevents abuse
- Nonce verification for all AJAX requests
- PDF files are stored outside web root when possible
- .htaccess protection for uploaded files
- File type and size validation
- Virus scanning integration ready
- No personal data sent to third-party APIs unless explicitly provided
- Conversation data stored locally in WordPress database
- GDPR compliance features available
- Verify your API keys are correct
- Check your server can make outbound HTTPS requests
- Ensure you have sufficient API credits
- Check file size limits (10MB default)
- Verify PDF is not password-protected
- Ensure PDF contains extractable text
- Check if widget is enabled in settings
- Verify there are no JavaScript errors
- Check theme compatibility
- Verify your hosting provider allows long-running requests
- Check Pinecone index performance
- Consider upgrading your OpenAI plan
Enable WordPress debug mode and plugin logging:
// wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
// Check logs in /wp-content/debug.log- Check the FAQ section
- Review troubleshooting guide
- Submit issues on GitHub
-
Clone Repository
git clone https://github.com/bhavik-dreamz/pdf-chat-support-for-wordpress.git
-
Install Dependencies
composer install # If using Composer for PDF parsing npm install # If using Node.js build tools
-
Setup Local WordPress
- Use Local by Flywheel, XAMPP, or Docker
- Symlink plugin directory to WordPress plugins folder
pdf-chat-support/
βββ pdf-chat-support.php # Main plugin file
βββ admin/ # Admin interface files
β βββ admin-page.php # Admin page handler
β βββ settings.php # Settings management
β βββ upload-handler.php # File upload handling
βββ includes/ # Core functionality
β βββ pinecone-handler.php # Pinecone API integration
β βββ pdf-processor.php # PDF text extraction
β βββ chat-handler.php # Chat message processing
β βββ embedding-generator.php # OpenAI integration
βββ frontend/ # Frontend components
β βββ chat-widget.php # Chat widget rendering
βββ assets/ # Static assets
β βββ css/ # Stylesheets
β βββ js/ # JavaScript files
β βββ images/ # Image assets
βββ languages/ # Translation files
βββ README.md # This file
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- Follow WordPress Coding Standards
- Use proper sanitization and validation
- Add inline documentation
- Include unit tests where possible
- Chunk Size: 1000 tokens (balance between context and performance)
- Similarity Threshold: 0.7 (prevents irrelevant responses)
- Rate Limiting: 60 requests/hour (prevents abuse)
- Max Response Tokens: 500 (keeps responses concise)
- Enable WordPress object caching
- Use Redis or Memcached for session storage
- Consider CDN for static assets
- Regular cleanup of old conversations
- Index optimization for message queries
- Archive old data periodically
The plugin is translation-ready with:
- Proper text domain usage
- Generated .pot file for translators
- RTL language support
- Date/time localization
To translate:
- Use the provided .pot file in
/languages/ - Create .po/.mo files for your language
- Submit translations back to the project
This plugin is licensed under the GPL v2 or later.
PDF Chat Support for WordPress
Copyright (C) 2025 Your Name
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
- WordPress community for the excellent plugin development resources
- Pinecone for providing vector database infrastructure
- OpenAI for AI and embedding capabilities
- Contributors and beta testers
- Documentation: Wiki
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with β€οΈ for the WordPress community