An Electron application with a React and TypeScript frontend and a Python backend, this project enables Retrieval-Augmented Generation (RAG)-powered chat and document question answering. The application allows users to select a folder, index its contents (including text and PDF files), and interact with a chat interface that can answer questions based on the indexed documents or via external language models.
Features#
- Chat interface with message history, auto-scrolling, and system messages.
- Model selection supporting GPT-4, GPT-3.5-turbo, Claude 3 Opus, Claude 3 Sonnet, Gemini Pro, and Llama 3.
- Folder selection for indexing and querying local documents in RAG mode.
- Backend integration via IPC with a Python service for document indexing and search.
- Support for a wide range of text file types and PDFs (with automatic PyPDF2 installation if needed).
- Progress reporting and error handling during indexing and querying.
- Multiline chat input with auto-resizing and Enter-to-send.
- Visual feedback for loading, indexing, and error states.
Recommended IDE Setup#
Use VSCode with the ESLint and Prettier extensions for best results.
Installation#
Install dependencies:
npm install
Development#
Start the application in development mode:
npm run dev
Building#
To build the application for your platform:
# For Windows
npm run build:win
# For macOS
npm run build:mac
# For Linux
npm run build:linux
Usage#
Start the app and use the chat interface to interact with language models or ask questions about your documents.
To use RAG mode, select a folder using the folder button. The app will index up to 500 files (text and PDFs) in the folder, displaying progress. Once indexing completes, toggle RAG mode to enable question answering based on the folder's content. Ask questions in the chat; the app will return answers with relevant file sources and previews.
Switch between language models using the model selector dropdown. The chat input supports multiline text and sends messages on Enter (without Shift).
The UI provides feedback for loading, indexing progress, and errors. System messages appear in the chat for important events or issues.
Backend Integration#
The Electron frontend communicates with the Python backend via IPC. Supported commands include:
pingpython:get-random-wordpython:read-filerag:index-folder(indexes files in a selected folder)rag:query(queries the indexed folder with a question and returns an answer with sources)dialog:select-folder(opens a dialog to select a folder)
The backend scans directories, reads file contents (with encoding and PDF support), creates a searchable index, and answers questions using keyword search and integration with a local language model API.
File Support and Limitations#
The indexer supports common text file types and PDFs. It skips unsupported formats (e.g., Word, Excel) and files larger than 2MB. Indexing is limited to 500 files per folder to avoid memory issues.
Error Handling#
The app displays error messages in the chat for issues such as failed indexing, unreadable files, or API errors. Progress indicators and system messages provide feedback during long-running operations.
For more details, refer to the project source code and comments.