OneClickCopyFlow is a Chrome extension that enhances code interaction on Stack Overflow by providing seamless code copying and AI-powered explanation features. The project consists of two main components:
- A Chrome extension for frontend interaction
- A Node.js server that processes code explanations using AI
- Smart Code Copying: Copy individual code blocks with a single click
- Bulk Copy: Copy all code blocks on the page using "alt+shift+c" shortcut
- AI-Powered Explanations: Get instant explanations for any code block
- Clean UI: Uses Shadow DOM for isolated styling and seamless integration
- Progress Notifications: Real-time feedback for all operations
- OpenAI Integration: Leverages advanced AI models for code analysis
- Redis Caching: Efficient response caching and rate limiting
- Clustered Processing: Utilizes all CPU cores for better performance
- Secure Configuration: Environment-based configuration management
-
Clone the repository:
git clone https://github.com/yourusername/OneClickCopyFlow.git cd OneClickCopyFlow -
Load in Chrome:
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer Mode"
- Click "Load unpacked" and select the extension directory
- Open Chrome and navigate to
-
Install dependencies:
npm install
-
Configure environment: Create
.envfile in the server directory: U can get free api key from hereOPENAI_API_KEY=your_key_here -
Install Redis:
- Download from Redis website
- Follow installation instructions for your OS
-
Start Redis:
cd "redis path" .\redis-server
-
Launch the server:
node server.js
Server will be available at
http://localhost:3000
manifest.json: Extension configurationcontent-script.js: Main extension logiccontent-script.css: Extension stylingbackground.js: Background processesnotification/: Notification components
src/my-server/server.js: Main server application.env: Environment configuration.env.sample: Configuration template
import OpenAI from "openai";
import dotenv from "dotenv";
dotenv.config();
const client = new OpenAI({
baseURL: "https://api.zukijourney.com/v1",
apiKey: process.env.OPENAI_API_KEY,
});- Uses Shadow DOM for isolated styling
- Implements custom event listeners for code block interaction
- Manages state through background processes
- OpenAI API: AI-powered code analysis
- Express: Web server framework
- Redis: Caching and rate limiting
- CORS: Cross-origin resource sharing
- dotenv: Environment management
- express-rate-limit: Request limiting
- marked: Markdown processing
- cluster: Process management
This project utilizes several open-source libraries and tools:
- AI API: GitHub - cool-ai-stuff
- Express: GitHub - Express
- CORS: GitHub - CORS
- Redis: GitHub - ioredis
- Extension Not Working: Verify Chrome extension is enabled and permissions are granted
- Server Connection Failed: Check if Redis and Node.js server are running
- API Limits: If you hit rate limits, wait or upgrade your API plan
- Ensure Redis is running and accessible
- Verify environment variables are correctly set
- Check console for detailed error messages
This project is licensed under the GNU General Public License - see the LICENSE file for details.