A modern desktop PDF reader with AI-powered analysis capabilities. Built with TypeScript, Electron, React, and PDF.js.
- Modern PDF Viewer: Built with PDF.js for reliable PDF rendering
- Text Selection: Select text with mouse or OCR-based area selection
- Cross-Platform: Windows, macOS, and Linux support
- Dark/Light Theme: Automatic system theme detection with manual override
- Multiple AI Providers: Support for OpenAI GPT and DeepSeek models
- Contextual Analysis: AI analyzes selected PDF text and provides insights
- Smart Conversations: Maintains conversation history for context-aware responses
- Custom System Prompts: Customize AI behavior for different document types
- Markdown Support: Rich text rendering with syntax highlighting
- Export Options: Export conversations as Markdown files
- Copy Functionality: Copy individual messages or entire conversations
- Message Regeneration: Regenerate AI responses if needed
- Persistent Settings: All configurations saved automatically
- API Key Management: Secure storage of API keys
- Auto-save: Settings and API keys saved automatically
- Language Support: Chinese and English interface
- Node.js (v16 or higher)
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/yourusername/reader-companion.git cd reader-companion
-
Install dependencies
npm install
-
Start development server
npm run dev
# Build for current platform
npm run build
# Build for all platforms
npm run build:all
# Build for specific platform
npm run build:win # Windows
npm run build:mac # macOS
npm run build:linux # Linux
- Open Settings: Click the settings icon in the chat panel
- Choose Provider: Select OpenAI or DeepSeek
- Add API Key: Enter your API key (auto-saved)
- Select Model: Choose from available models
- Test Connection: Verify your configuration works
OpenAI
- GPT-4
- GPT-4 Turbo
- GPT-3.5 Turbo
- GPT-3.5 Turbo 16K
DeepSeek
- DeepSeek Chat
- DeepSeek Coder
You can configure custom API endpoints for self-hosted or third-party compatible APIs.
- Open PDF: Use Ctrl+O or menu to open a PDF file
- Select Text: Click and drag to select text in the PDF
- AI Analysis: Selected text is automatically sent to AI for analysis
- Chat: Continue the conversation with follow-up questions
- Export: Save your conversation as a Markdown file
- PDF Text Layer: Direct text selection from PDF (when available)
- OCR Selection: Draw rectangles to select areas for OCR text recognition
- Automatic Fallback: System automatically switches to OCR if text layer fails
Ctrl+O
: Open PDF fileEnter
: Send message in chatShift+Enter
: New line in chat input
- Frontend: React 18 with TypeScript
- Desktop: Electron for cross-platform desktop app
- PDF Rendering: PDF.js for reliable PDF display
- OCR: Tesseract.js for optical character recognition
- Styling: Tailwind CSS with dark mode support
- State Management: React Context API
- Build: Vite for fast development and building
src/
βββ components/ # React components
β βββ ChatPanel.tsx # Chat interface
β βββ PDFViewer.tsx # PDF display and selection
β βββ SettingsPanel.tsx # Configuration UI
β βββ MessageBubble.tsx # Chat message display
βββ contexts/ # React contexts
β βββ AppContext.tsx # Global app state
β βββ ChatContext.tsx # Chat functionality
β βββ PDFContext.tsx # PDF state management
βββ services/ # Business logic
β βββ aiService.ts # AI API integration
βββ i18n/ # Internationalization
β βββ translations.ts # Translation definitions
β βββ useTranslation.ts # Translation hook
βββ types/ # TypeScript definitions
βββ App.tsx # Main application component
- PDF Loading: Electron main process handles file dialogs and loading
- Text Selection: Component captures selection and stores in context
- AI Processing: Service layer handles API requests to AI providers
- UI Updates: React contexts trigger re-renders with new data
- Persistence: Settings automatically saved via Electron APIs
- Local Storage: All settings and conversations stored locally
- API Key Security: Keys encrypted and stored in system keychain
- No Data Collection: No telemetry or usage data sent externally
- Offline Capable: OCR processing works offline
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow TypeScript best practices
- Use existing component patterns
- Write clear commit messages
- Test on multiple platforms when possible
This project is licensed under the MIT License - see the LICENSE file for details.
- PDF.js - PDF rendering
- Tesseract.js - OCR functionality
- Electron - Desktop app framework
- React - UI framework
- Tailwind CSS - Styling framework
Vibe coded with Claude code