Skip to content

Repository files navigation

ReadPilot

ReadPilot 是一款 Chrome 浏览器扩展,让你在浏览器中阅读本地学术论文时获得 AI 辅助。

ReadPilot is a Chrome extension that helps you read local academic papers with AI assistance.


功能 / Features

  • 上传本地 PDF / Upload local PDFs
  • PDF.js 渲染,支持连续滚动与缩放 / PDF.js rendering with continuous scrolling and zoom
  • 划词翻译、解释、提问 / Translate, explain, and ask about selected text
  • 选中章节标题时自动扩展为整章上下文 / Auto-expand context to full chapter when a heading is selected
  • 右侧 AI 侧边栏,支持自由问答与自动全文总结 / AI sidebar with Q&A and auto full-text summary
  • 可折叠的论文结构面板,点击章节跳转对应页面 / Collapsible paper structure panel with click-to-jump
  • 拖拽调整侧边栏宽度与输入框高度 / Drag to resize sidebar width and input height
  • 阅读历史与对话持久化 / Reading history and conversation persistence
  • 浅色 / 深色 / 跟随系统主题 / Light / dark / system theme
  • 所有 Prompt 模板可在设置页自定义 / All prompt templates customizable in settings

技术栈 / Tech Stack

  • React 18 + TypeScript 5
  • Vite 5
  • Tailwind CSS 3
  • pdfjs-dist
  • react-markdown + remark-gfm
  • Chrome Manifest V3

开发 / Development

# 安装依赖 / Install dependencies
npm install

# 开发模式(用于代码检查,Chrome 扩展仍需加载 dist 目录)
# Dev mode for code checking; extension still needs to load dist/ in Chrome
npm run dev

# 构建生产版本 / Build for production
npm run build

# ESLint 检查 / Lint
npm run lint

在 Chrome 中加载扩展 / Load the Extension in Chrome

  1. 执行 npm run build 生成 dist/ 目录。/ Run npm run build to generate the dist/ directory.
  2. 打开 Chrome,进入 chrome://extensions/。/ Open Chrome and go to chrome://extensions/.
  3. 打开右上角“开发者模式”。/ Turn on Developer mode in the top-right corner.
  4. 点击“加载已解压的扩展程序”,选择项目根目录下的 dist 文件夹。/ Click Load unpacked and select the dist folder.
  5. 点击扩展图标即可使用。/ Click the extension icon to use it.

配置 AI Provider / Configure AI Provider

首次使用前,点击扩展弹窗中的“设置”,填写:

  • Base URL:例如 https://api.openai.com/v1
  • Model:例如 gpt-4o-mini
  • API Key:你的 API key

Before first use, click Settings in the popup and fill in:

  • Base URL, e.g. https://api.openai.com/v1
  • Model, e.g. gpt-4o-mini
  • API Key

支持所有 OpenAI 兼容接口,包括 Kimi、DeepSeek、SiliconFlow、Groq 等。
Supports all OpenAI-compatible APIs, including Kimi, DeepSeek, SiliconFlow, Groq, etc.


项目结构 / Project Structure

src/
├── background/      # Service Worker
├── db/              # IndexedDB 封装 / IndexedDB wrapper
├── options/         # 设置页 / Settings page
├── popup/           # 扩展弹窗 / Extension popup
├── reader/          # PDF 阅读页 / PDF reader page
├── services/        # LLM、PDF、上传、主题服务 / LLM, PDF, upload, theme services
├── types/           # TypeScript 类型 / TypeScript types
└── utils/           # 工具函数 / Utilities

注意事项 / Notes

  • 首次打开 PDF 时,扩展会尝试通过文件上传接口生成总结;如果当前 provider 不支持,则回退到提取全文文本总结。
    On first open, the extension tries to summarize via file upload; if unsupported, it falls back to extracted text.
  • 长论文可能超出模型上下文限制,总结会被截断。
    Long papers may exceed model context limits and will be truncated.
  • PDF.js 渲染时会 detach ArrayBuffer,项目中对同一份 PDF 的多次使用都会先克隆 buffer。
    PDF.js may detach ArrayBuffer; the project clones buffers before reuse.

License

MIT

About

A chrome extension used for paper reading with the aid of LLM.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages