Skip to content

Latest commit

 

History

History
75 lines (53 loc) · 2.98 KB

File metadata and controls

75 lines (53 loc) · 2.98 KB

Reddit Thread AI Reader

English | 简体中文

A Tampermonkey userscript that adds an AI reading panel to Reddit thread pages. It summarizes the visible post and comments, then lets you ask follow-up questions with your own OpenAI-compatible Chat Completions endpoint.

Features

  • Adds a lightweight floating button on Reddit thread pages.
  • Opens a Shadow DOM sidebar that avoids polluting Reddit page styles.
  • Extracts the currently visible thread title, post body, subreddit, author metadata, and visible comments.
  • Generates structured Markdown summaries with streaming output when supported.
  • Supports follow-up Q&A based on the extracted thread context.
  • Provides local settings for API URL, API key, model, prompts, streaming, theme, and comment limits.
  • Stores configuration in Tampermonkey local storage through userscript APIs.

Scope

This project is a page-level reading assistant, not a Reddit automation or data collection tool.

  • It only works with the Reddit thread page the user is already viewing.
  • It only reads visible page content from the browser DOM.
  • It does not use the Reddit API.
  • It does not batch crawl Reddit pages.
  • It does not post, reply, vote, message, follow, or operate accounts.
  • It does not include a backend service for storing Reddit content.
  • It is not intended for model training datasets or automated monitoring.

Installation

  1. Install a userscript manager such as Tampermonkey.
  2. Open userscripts/reddit-thread-ai.user.js.
  3. Install or update the script in the userscript manager.
  4. Open a Reddit thread page such as https://www.reddit.com/r/<subreddit>/comments/<id>/....
  5. Use the Reddit AI Reader button to open the sidebar.

Configuration

Open the Settings tab in the sidebar and configure:

  • API URL: an OpenAI-compatible Chat Completions endpoint.
  • API Key: stored locally by the userscript manager.
  • Model: the model name supported by your endpoint.
  • Summary Prompt: instructions for thread summaries.
  • Chat Prompt: instructions for follow-up Q&A.
  • Streaming: whether to use streamed responses when available.
  • Max visible comments: the maximum number of visible comments to include.

Do not commit real API keys, private endpoints, screenshots with secrets, or personal account data.

Compatibility

The script targets Reddit thread pages on:

  • https://www.reddit.com/*
  • https://new.reddit.com/*
  • https://old.reddit.com/*

Reddit changes its frontend markup over time, so extraction selectors may need maintenance.

Development

The main userscript lives at:

userscripts/reddit-thread-ai.user.js

When changing extraction or LLM behavior, verify:

  • The sidebar opens on a Reddit thread page.
  • Title, body, and visible comments are extracted.
  • Missing API configuration is handled gracefully.
  • Summaries and follow-up answers stay grounded in the visible thread context.
  • API keys never appear in source code, logs, screenshots, or documentation.