reader/README.md

104 lines
3.7 KiB
Markdown
Raw Permalink Normal View History

2024-09-28 16:39:52 +08:00
# 📚 Reader: Local Deployment Edition
2024-08-15 19:00:32 +08:00
2024-09-29 18:20:25 +08:00
🌟 **Live Demo:**
2024-09-29 18:40:29 +08:00
Example: [https://reader.berlin.cx/https://github.com/intergalacticalvariable/reader/](https://reader.berlin.cx/https://github.com/intergalacticalvariable/reader/)
2024-09-29 18:20:25 +08:00
2024-09-28 16:39:52 +08:00
This is an adapted version of [Jina AI's Reader](https://github.com/jina-ai/reader) for local deployment using Docker.
2024-08-15 19:00:32 +08:00
2024-09-28 16:39:52 +08:00
## 🎯 What it does
It converts any URL to an LLM-friendly input with `http://127.0.0.1:3000/https://google.com`. Get improved output for your agent and RAG systems at no cost. This tool helps you prepare web content for Large Language Models, making it easier to process and analyze online information.
2024-08-15 19:00:32 +08:00
2024-09-28 16:39:52 +08:00
## 🚀 Key Features
- 🏠 Runs locally using Docker
- 🔑 No API keys required - works out of the box!
- 🖼️ Saves screenshots locally instead of uploading to Google Cloud Storage
- 📥 Provides download URLs for saved screenshots
- 🌐 Converts web content to LLM-friendly formats
2024-08-15 19:00:32 +08:00
2024-09-28 16:39:52 +08:00
## ⚠️ Limitations
- 📄 Currently does not support parsing PDFs
2024-08-15 19:00:32 +08:00
2024-09-29 18:35:12 +08:00
## 💻 Demo Environment
The live demo is running on a VPS with the following specifications:
- CPU: 1 vCore
- RAM: 0.5 GB
- Web Server: nginx
This demonstrates that the Reader can run effectively even on minimal hardware resources.
2024-09-28 16:39:52 +08:00
## 🐳 Docker Deployment
2024-09-28 16:15:56 +08:00
### Option 1: Using the pre-built image
2024-09-28 16:39:52 +08:00
1. Pull the latest image:
2024-09-28 16:15:56 +08:00
```bash
docker pull ghcr.io/intergalacticalvariable/reader:latest
```
2024-09-28 16:39:52 +08:00
2. Run the container:
2024-09-28 16:54:28 +08:00
```bash
docker run -d -p 3000:3000 -v /path/to/local-storage:/app/local-storage --name reader-container ghcr.io/intergalacticalvariable/reader:latest
```
2024-09-28 16:47:36 +08:00
Replace `/path/to/local-storage` with the directory where you want to store screenshots.
2024-09-28 16:54:28 +08:00
This command does the following:
- Maps port 3000 of the container to port 3000 on your host
- Mounts a volume for local storage
- Names the container `reader-container`
3. To stop the container:
```bash
docker stop reader-container
```
4. To start the container again:
2024-09-28 16:15:56 +08:00
```bash
2024-09-28 16:54:28 +08:00
docker start reader-container
2024-09-28 16:15:56 +08:00
```
2024-09-28 16:39:52 +08:00
### Option 2: Building the image locally
2024-09-28 16:15:56 +08:00
1. Clone the repository:
```bash
git clone https://github.com/intergalacticalvariable/reader.git
cd reader
```
2. Build the Docker image:
```bash
docker build -t reader .
```
2024-09-28 16:39:52 +08:00
3. Run the container:
2024-09-28 16:15:56 +08:00
```bash
2024-09-28 16:39:52 +08:00
docker run -p 3000:3000 -v /path/to/local-storage:/app/local-storage reader
2024-09-28 16:15:56 +08:00
```
2024-09-28 16:39:52 +08:00
## 🖥️ Usage
Once the Docker container is running, you can use curl to make requests. Here are examples for different response types:
2024-04-16 12:50:34 +08:00
2024-09-28 16:39:52 +08:00
1. 📝 Markdown (bypasses readability processing):
```bash
2024-09-28 18:51:20 +08:00
curl -H "X-Respond-With: markdown" 'http://127.0.0.1:3000/https://google.com'
2024-09-28 16:39:52 +08:00
```
2024-04-25 16:06:24 +08:00
2024-09-28 16:39:52 +08:00
2. 🌐 HTML (returns documentElement.outerHTML):
```bash
2024-09-28 18:51:20 +08:00
curl -H "X-Respond-With: html" 'http://127.0.0.1:3000/https://google.com'
2024-09-28 16:39:52 +08:00
```
2024-04-24 23:28:55 +08:00
2024-09-28 16:39:52 +08:00
3. 📄 Text (returns document.body.innerText):
```bash
2024-09-28 18:51:20 +08:00
curl -H "X-Respond-With: text" 'http://127.0.0.1:3000/https://google.com'
2024-09-28 16:39:52 +08:00
```
2024-05-15 18:54:47 +08:00
2024-09-28 18:51:20 +08:00
4. 📸 Screen-Size Screenshot (returns the URL of the webpage's screenshot):
2024-09-28 16:39:52 +08:00
```bash
2024-09-28 18:51:20 +08:00
curl -H "X-Respond-With: screenshot" 'http://127.0.0.1:3000/https://google.com'
```
2024-09-29 18:20:25 +08:00
2024-09-28 18:51:20 +08:00
5. 📸 Full-Page Screenshot (returns the URL of the webpage's screenshot):
```bash
curl -H "X-Respond-With: pageshot" 'http://127.0.0.1:3000/https://google.com'
2024-09-28 16:39:52 +08:00
```
2024-07-24 15:59:13 +08:00
2024-09-28 16:39:52 +08:00
## 🙏 Acknowledgements
2024-09-28 16:49:56 +08:00
This project is based on the excellent work done by multiple contributors:
1. The original [Jina AI Reader project](https://github.com/jina-ai/reader), which provided the foundation for this tool.
2024-09-29 18:45:11 +08:00
2. [Harsh Gupta's adaptation](https://github.com/hargup/reader), which served as the immediate basis for this Docker deployment version.
2024-09-28 16:49:56 +08:00
2024-09-28 16:39:52 +08:00
## 📜 License
2024-09-28 16:45:57 +08:00
This project is licensed under Apache-2.0 same as the original Jina AI Reader project.