Skip to content

daishir0/Papernote

Repository files navigation

Papernote

Paper Library

日本語のREADMEは、英語のREADMEの後に記載されています。

Overview

Papernote is an AI-native paper management and note-taking web application. Upload an academic PDF and it is automatically processed by an AI pipeline that extracts metadata, writes a chapter-by-chapter summary, generates a 4-perspective peer-review evaluation, and (optionally) produces a full Japanese translation. Each paper gets a public, shareable workspace where you can read the AI outputs, keep your own Markdown/Mermaid notes, view the PDF, and ask the AI questions about the paper.

It also retains the original Papernote strengths: free-form Markdown/Mermaid notes, file search, user authentication, rate limiting, CSRF protection, real-time Markdown preview, an AI editing assistant, automatic backups with diff viewing, and extensive keyboard shortcuts — fully optimized for both PC and smartphone.

Paper Workspace

Key AI Features

  • Unified AI Engine (2-tier): choose an execution mode (direct = single API call, or agent = OpenHands agent loop) × a backend (OpenAI / Anthropic / Codex subscription) per task, all configurable from a settings screen.
  • Automatic pipeline on upload: metadata extraction → chapter summary → 4-perspective peer review (novelty / difference from related work / effectiveness / reliability) → full translation.
  • Paper Library (/papers): responsive card grid with thumbnails, client-side search and status filters; logged-in users also get an interactive knowledge-graph view.
  • Paper Workspace (/paper/<hash>): single-column collapsible sections (Notes / Summary / Evaluation / Translation / PDF / Ask-AI), public read-only with OGP/SNS sharing; editing, regeneration, deletion and AI Q&A require login. Notes and the PDF are visible to logged-in users only.
  • Per-paper AI Q&A: ask questions grounded in the paper's full text.
  • Knowledge Graph (login-only, /papersGraph tab): an interactive tag→paper graph (Cytoscape) with directed edges from each tag to the papers that carry it. Toggle tags on/off to focus on a subset (your selection is remembered across visits, so the view stays light), search by title/tag, right-click a paper for quick actions, open papers in a new tab/window, and the layout is saved automatically. Handy for gathering references while writing. On mobile the tag filter collapses into a single toggle to keep the canvas large.
  • AI Settings (/ai_settings): assign mode/backend/model per task, edit prompts, and run backend connectivity tests.

Knowledge Graph (login)

Installation

  1. Ensure poppler-utils is installed on your system (required by pdf2image for PDF thumbnails).
    sudo apt-get install poppler-utils   # Debian/Ubuntu
    # or: sudo dnf install poppler-utils  # Fedora/Amazon Linux
  2. Clone the repository:
    git clone https://github.com/daishir0/Papernote
  3. Change to the project directory:
    cd Papernote
  4. Install the required packages:
    pip install -r requirements.txt
  5. Copy config.yaml.sample.org to config.yaml and edit it. Key fields:
    • allowed_extensions: Allowed upload file extensions (jpg, png, svg, pdf, docx, xlsx, pptx, zip, etc.).
    • exclude_string: A string that, if found in a memo line, excludes that line from being shown.
    • twitter: site / creator handles for OGP/Twitter cards.
    • server.port: Server port (default 5555).
    • openai_api_key / anthropic_api_key: API keys for the direct backends (environment variables OPENAI_API_KEY / ANTHROPIC_API_KEY take precedence).
    • codex_oauth_client_id: OAuth client ID for the Codex (ChatGPT) subscription backend (env CODEX_OAUTH_CLIENT_ID takes precedence; optional).
    • gmail: sender_email / recipient_email / app_password for email notifications.
    • secret_key: Secret key for session management and CSRF protection.
    • users: Login usernames and passwords.
    • api_keys: API keys for the external upload/processing API.
  6. (Optional, for the AI pipeline) Copy the ai: block from config.yaml.sample.org into ai_config.yaml to customize per-task mode/backend/model and prompts. The agent mode and codex backend require a running OpenHands Agent Server (default http://127.0.0.1:3025); if you only use direct mode with OpenAI/Anthropic, OpenHands is not needed.

Usage

  1. Start the application:
    python main.py
  2. Access the web interface at http://localhost:5555.
  3. Open /papers for the paper library, or upload a PDF to trigger the automatic AI pipeline. Each paper's workspace is at /paper/<hash>.

Features

AI Paper Management

  • Automatic AI pipeline: on upload, metadata, chapter summary, 4-perspective peer-review evaluation, and translation are generated in the background with per-step progress and quality checks (jobs/<id>.json).
  • Regeneration: regenerate any step (metadata / summary / review / translation) from the workspace, optionally overriding the backend/mode.
  • Public sharing: paper workspaces are publicly readable with OGP/Twitter-card metadata; editing and AI actions are gated behind login (notes and the PDF stay private to logged-in users).
  • Tagging & knowledge graph: tag papers from the memo's second line (wrap multi-word tags in double quotes, e.g. a11y "knowledge graph"); a login-only graph view on /papers visualizes tag→paper relationships with toggleable tags (selection persisted), search, and a saved layout.
  • Multi-backend: OpenAI, Anthropic, and Codex (subscription) backends with automatic fallback when an agent run fails.

Core Features

  • User Authentication: Secure login/logout using Flask-Login.
  • Rate Limiting: Protect routes from abuse with Flask-Limiter.
  • CSRF Protection: Secure forms with Flask-WTF CSRF protection.
  • PDF Management: Upload, search, and manage PDF files (SHA256-based naming, deduplication).
  • Text Extraction: Extract and clean text from PDF files.
  • File Attachments: Upload and manage attachments with drag-and-drop support.

Editing & Writing Features

  • Real-time Markdown Preview: Live preview with synchronized scrolling (PC).
  • AI Assistant: Integrated AI editing assistant with customizable templates and system prompts (ALT+A).
  • Keyboard Shortcuts:
    • ALT+1: Heading (#) / ALT+2: Unordered list (-) / ALT+3: Ordered list (1.)
    • ALT+4: Blockquote (>) / ALT+5: Bold / ALT+6: 4-space indent toggle
    • Ctrl+K: Quick page navigation / Ctrl+S: Save
  • Multi-line Markdown Formatting, Quick Insert Menu, Comment Addition.
  • Markdown & Mermaid rendering with XSS sanitization (DOMPurify), plus an image slideshow viewer.

File & Media Management

  • Multiple File Upload: Drag-and-drop multiple files with visual progress.
  • HEIC Image Support: Automatic HEIC→JPEG conversion.
  • Image Slideshow: Built-in viewer with preloading.

Backup & History

  • Backup Management: Timestamp-based automatic backups, history view, color-coded diff viewer, quick restore, mobile-optimized.

Navigation & Organization

  • Quick Page Switcher (Ctrl+K), Open in New Tab, File List Caching, Dynamic Browser Titles, Persistent Preview State.

Mobile Optimization

  • Responsive Design for smartphone and tablet, full-page scrolling, touch-friendly buttons, responsive tables and images.

Security

  • Open Redirect Protection, CSRF protection, Secure file uploads, secrets resolved from environment variables first (live config and AI config are gitignored).

AI Engine & Configuration

The unified AI engine lives in ai_engine.py, and the paper pipeline in paper_ai.py.

  • Tasks (ai_assist, paper_metadata, paper_summary, paper_review, paper_translate) are configured in ai_config.yaml under ai.tasks, each with a mode (direct/agent), backend (openai/anthropic/codex), optional model, and a prompt_id.
  • Prompts are defined under ai.prompts and editable from the /ai_settings screen.
  • Secrets are resolved from environment variables first, then config.yaml.
  • Agent mode / Codex require an OpenHands Agent Server; direct mode with OpenAI/Anthropic works standalone.

Notes

  • Ensure config.yaml is properly configured. Live config.yaml / ai_config.yaml are gitignored — use config.yaml.sample.org as the template.
  • The application requires Flask and the dependencies in requirements.txt.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Papernote

論文ライブラリ

概要

Papernoteは AIネイティブな論文管理・ノートアプリ です。学術論文のPDFをアップロードすると、AIパイプラインが自動で「メタデータ抽出 → 章ごとの要約 → 4観点の査読評価 → (任意で)全文和訳」を生成します。各論文には公開・共有可能なワークスペースが用意され、AIの生成結果を読み、自分のMarkdown/Mermaidノートを残し、PDFを閲覧し、論文についてAIに質問できます。

従来からのPapernoteの強み(自由なMarkdown/Mermaidノート、ファイル検索、ユーザー認証、レート制限、CSRF保護、リアルタイムMarkdownプレビュー、AI編集アシスタント、差分表示付き自動バックアップ、豊富なキーボードショートカット)もそのまま備え、PC・スマホ両対応です。

論文ワークスペース

主なAI機能

  • 統一AI基盤(2層構成): タスクごとに実行モード(direct=単発API / agent=OpenHandsエージェント)×バックエンド(OpenAI / Anthropic / Codexサブスク)を選択でき、設定画面から構成可能。
  • アップロード時の全自動パイプライン: メタ抽出 → 章ごと要約 → 4観点査読評価(新規性 / 関連研究との相違 / 有効性 / 信頼性)→ 全文和訳。
  • 論文ライブラリ/papers): サムネ付きレスポンシブカードグリッド、検索・ステータスフィルタ。ログイン時はインタラクティブな知識グラフビューも利用可能。
  • 論文ワークスペース/paper/<hash>): 1カラムの折りたたみセクション(ノート / 要約 / 評価 / 和訳 / PDF / AI質問)。公開・読取専用+OGP/SNSシェア対応。編集・再生成・削除・AI質問はログイン時のみ。ノートとPDFはログインユーザーにのみ表示。
  • 論文ごとのAI質問: 論文の全文を根拠に質問できる。
  • 知識グラフ(ログイン限定・/papers の「グラフ」タブ): タグ→論文の有向グラフ(Cytoscape)。各タグからそのタグを持つ論文へ矢印が伸びる。タグのON/OFFで対象を絞り込め(選択状態は次回も記憶されるので表示が重くならない)、タイトル/タグ検索、論文の右クリックメニュー、新しいタブ/ウインドウで開く、レイアウト自動保存に対応。論文執筆時の参考文献収集に便利。スマホではタグ絞り込みが1つのトグルに折りたたまれ、キャンバスを広く使える。
  • AI設定/ai_settings): タスク別のモード/バックエンド/モデル割当、プロンプト編集、接続テスト。

知識グラフ(ログイン時)

インストール方法

  1. poppler-utils をインストールします(pdf2image のPDFサムネ生成に必要)。
    sudo apt-get install poppler-utils   # Debian/Ubuntu
    # または: sudo dnf install poppler-utils  # Fedora/Amazon Linux
  2. リポジトリをクローンします:
    git clone https://github.com/daishir0/Papernote
  3. プロジェクトディレクトリに移動します:
    cd Papernote
  4. 必要なパッケージをインストールします:
    pip install -r requirements.txt
  5. config.yaml.sample.orgconfig.yaml にコピーして編集します。主なフィールド:
    • allowed_extensions: アップロード許可拡張子(jpg, png, svg, pdf, docx, xlsx, pptx, zip など)。
    • exclude_string: メモ行に含まれると表示から除外する文字列。
    • twitter: OGP/Twitterカード用の site / creator ハンドル。
    • server.port: サーバーポート(既定 5555)。
    • openai_api_key / anthropic_api_key: directバックエンド用APIキー(環境変数 OPENAI_API_KEY / ANTHROPIC_API_KEY が優先)。
    • codex_oauth_client_id: Codex(ChatGPT)サブスクのOAuthクライアントID(環境変数 CODEX_OAUTH_CLIENT_ID 優先・任意)。
    • gmail: メール通知用の sender_email / recipient_email / app_password
    • secret_key: セッション管理・CSRF保護用のシークレットキー。
    • users: ログイン用のユーザー名・パスワード。
    • api_keys: 外部アップロード/処理API用のキー。
  6. (任意・AIパイプライン用)config.yaml.sample.orgai: ブロックを ai_config.yaml にコピーし、タスク別のモード/バックエンド/モデル・プロンプトを調整します。agent モードと codex バックエンドは OpenHands Agent Server(既定 http://127.0.0.1:3025)が必要です。OpenAI/Anthropicの direct モードのみなら OpenHands は不要です。

使い方

  1. アプリケーションを開始します:
    python main.py
  2. http://localhost:5555 でウェブインターフェースにアクセスします。
  3. /papers で論文ライブラリを開く、またはPDFをアップロードすると自動AIパイプラインが起動します。各論文のワークスペースは /paper/<hash> です。

機能

AI論文管理

  • 全自動AIパイプライン: アップロード時に、メタデータ・章ごと要約・4観点査読評価・和訳をバックグラウンド生成(ステップ別の進捗と品質チェック付き jobs/<id>.json)。
  • 再生成: 各ステップ(メタ/要約/評価/和訳)をワークスペースから再生成(バックエンド/モード上書き可)。
  • 公開シェア: ワークスペースはOGP/Twitterカード付きで公開・読取可。編集・AI操作はログイン限定(ノートとPDFはログインユーザーのみ閲覧可)。
  • タグ付けと知識グラフ: メモの2行目でタグ付け(2語以上のタグはダブルクォートで囲む。例: a11y "knowledge graph")。/papers のログイン限定グラフビューでタグ→論文の関係を可視化し、タグのON/OFF切替(選択を記憶)・検索・レイアウト保存に対応。
  • マルチバックエンド: OpenAI / Anthropic / Codex(サブスク)に対応、agent失敗時の自動フォールバックあり。

基本機能

  • ユーザー認証(Flask-Login)、レート制限(Flask-Limiter)、CSRF保護(Flask-WTF)。
  • PDF管理: アップロード・検索・管理(SHA256命名・重複排除)。
  • テキスト抽出: PDFからのテキスト抽出と整形。
  • ファイル添付: ドラッグ&ドロップ対応。

編集・執筆機能

  • リアルタイムMarkdownプレビュー(PC・スクロール同期)。
  • AIアシスタント: テンプレート/システムプロンプトをカスタムできる編集アシスタント(ALT+A)。
  • キーボードショートカット: ALT+1見出し / ALT+2箇条書き / ALT+3番号リスト / ALT+4引用 / ALT+5太字 / ALT+6インデント / Ctrl+Kページ移動 / Ctrl+S保存。
  • 複数行Markdown整形クイック挿入メニューコメント追加
  • Markdown/Mermaidレンダリング(DOMPurifyでXSS無害化)、画像スライドショー

ファイル・メディア管理

  • 複数ファイルアップロード(進捗表示)、HEIC→JPEG自動変換画像スライドショー(プリロード)。

バックアップ・履歴

  • バックアップ管理: タイムスタンプ自動バックアップ、履歴表示、色分け差分ビューア、クイック復元、モバイル最適化。

ナビゲーション・整理

  • クイックページスイッチャー(Ctrl+K)、新しいタブで開くファイルリストキャッシュ動的タイトルプレビュー状態の永続化

モバイル最適化

  • レスポンシブデザイン(スマホ・タブレット)、フルページスクロール、タッチ最適化ボタン、レスポンシブテーブル/画像。

セキュリティ

  • オープンリダイレクト保護CSRF保護安全なファイルアップロード、秘密値は環境変数優先(ライブのconfig.yaml/ai_config.yamlはgitignore対象)。

AI基盤と設定

統一AI基盤は ai_engine.py、論文パイプラインは paper_ai.py にあります。

  • タスクai_assist, paper_metadata, paper_summary, paper_review, paper_translate)は ai_config.yamlai.tasks で設定。各タスクに mode(direct/agent)・backend(openai/anthropic/codex)・任意の modelprompt_id を指定。
  • プロンプトai.prompts に定義し、/ai_settings 画面から編集可能。
  • 秘密値は環境変数を優先し、無ければ config.yaml を使用。
  • agentモード/CodexはOpenHands Agent Serverが必要。OpenAI/Anthropicのdirectモードは単体で動作。

注意点

  • config.yaml を正しく設定してください。ライブの config.yaml / ai_config.yaml はgitignore対象です。雛型として config.yaml.sample.org を使用してください。
  • アプリにはFlaskおよび requirements.txt の依存関係が必要です。

ライセンス

このプロジェクトはMITライセンスの下でライセンスされています。詳細はLICENSEファイルを参照してください。

About

Papernote is a web application that manages PDF files and their associated notes and summaries. It includes features like authentication, file upload, text extraction, and file search.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors