← Back to Skills Marketplace
534422530

阅读助手

by 534422530 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
26
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install laosi-reading-assistant
Description
阅读助手 - 贴链接或粘贴文字,自动提炼4点:主旨/论据/行动/疑问,不用读全文。支持网页抓取和本地文本
README (SKILL.md)

Reading Assistant - 阅读助手

激活词: 读一下 / 总结 / 提炼 / 摘要

功能

  • 4点结构化提炼:主旨 / 论据 / 行动 / 疑问
  • 支持网页URL抓取和纯文本输入
  • 自动保存阅读记录到知识库

Python 实现

import os, json, re
from datetime import datetime

class ReadingAssistant:
    def __init__(self):
        self.log_file = os.path.join(os.path.dirname(__file__), "reading_log.json")
    
    def extract(self, text: str, source: str = "text") -> dict:
        """对输入文本做4点结构化提炼"""
        # 分段落
        paragraphs = [p.strip() for p in re.split(r'\
\
+', text) if p.strip()]
        
        result = {
            "source": source,
            "timestamp": datetime.now().isoformat(),
            "stats": {
                "paragraphs": len(paragraphs),
                "total_chars": len(text),
                "total_words": len(text.split())
            },
            "extraction": {
                "main_idea": self._extract_main_idea(paragraphs),
                "key_arguments": self._extract_arguments(paragraphs),
                "action_items": self._extract_actions(paragraphs),
                "open_questions": self._extract_questions(text)
            }
        }
        
        self._log(result)
        return result
    
    def _extract_main_idea(self, paragraphs: list) -> str:
        """提取主旨:取第一段或包含关键词的句子"""
        candidates = [p for p in paragraphs if any(k in p.lower() 
                      for k in ["this paper", "we propose", "in this", "本文", "我们提出"])]
        if candidates:
            return candidates[0][:300]
        return paragraphs[0][:300] if paragraphs else ""
    
    def _extract_arguments(self, paragraphs: list) -> list:
        """提取论据:含数据/引用的段落"""
        args = []
        for p in paragraphs:
            if any(k in p for k in ["%", "图", "table", "实验", "accuracy", "结果表明", "实验表明"]):
                args.append(p[:200])
        return args[:5]
    
    def _extract_actions(self, paragraphs: list) -> list:
        """提取行动项:含should/must/需要/应该的句子"""
        actions = []
        for p in paragraphs:
            sentences = re.split(r'[。.!?]', p)
            for s in sentences:
                if any(k in s for k in ["should", "must", "need", "需要", "应该", "建议", "推荐"]):
                    actions.append(s.strip())
        return actions[:5]
    
    def _extract_questions(self, text: str) -> list:
        """提取开放问题:含问号的句子"""
        questions = re.findall(r'[^。]*?[??][^。]*', text)
        return [q.strip() for q in questions][:5]
    
    def _log(self, result: dict):
        """保存阅读记录"""
        logs = []
        if os.path.exists(self.log_file):
            with open(self.log_file, encoding="utf-8") as f:
                logs = json.load(f)
        logs.append(result)
        with open(self.log_file, "w", encoding="utf-8") as f:
            json.dump(logs, f, ensure_ascii=False, indent=2)

# 使用示例
reader = ReadingAssistant()

# 从文本提炼
article = """
We propose FlashAttention, a novel attention algorithm that computes exact attention
with significantly fewer memory accesses. Our experiments show 2-4x speedup over
baseline implementations on GPT-2 and BERT. The key insight is to tile the attention
computation, avoiding materialization of the full N×N attention matrix. 
We recommend using block sizes of 128×128 for optimal performance.
"""
result = reader.extract(article, source="AI论文: FlashAttention")
print(f"主旨: {result['extraction']['main_idea'][:80]}...")
print(f"论据: {len(result['extraction']['key_arguments'])} 条")
print(f"行动: {result['extraction']['action_items']}")

网页抓取模式

from urllib.request import urlopen
from urllib.parse import urlparse

def extract_url(url: str) -> dict:
    """从URL抓取并提炼"""
    try:
        resp = urlopen(url, timeout=10)
        html = resp.read().decode("utf-8", errors="ignore")
        # 简单去标签
        text = re.sub(r'\x3C[^>]+>', '', html)
        text = re.sub(r'\s+', ' ', text).strip()
        reader = ReadingAssistant()
        return reader.extract(text, source=url)
    except Exception as e:
        return {"error": str(e)}

# 使用示例
# result = extract_url("https://arxiv.org/abs/2205.14135")

输出格式

📄 阅读摘要
━━━━━━━━━━━━━━━━━━━━
💡 主旨:
  FlashAttention通过分块计算注意力,
  避免完整N×N矩阵物化,实现2-4x加速

📊 论据:
  1. GPT-2和BERT上验证2-4x加速
  2. 推荐块大小128×128

✅ 行动:
  - 建议在长序列任务中使用FlashAttention

❓ 疑问:
  - 是否支持梯度检查点?

使用场景

  1. 论文快速浏览: 贴arXiv链接,30秒了解核心贡献
  2. 公众号文章: 太长不看?提炼4点够了
  3. 技术文档: API文档的快速导航
  4. 邮件处理: 长邮件自动摘要

依赖

  • Python 3.8+
  • urllib (标准库,可选URL抓取)
Usage Guidance
Install only if you are comfortable with a local reading_log.json history of summaries, source labels or URLs, timestamps, and extracted snippets. Avoid using it on confidential emails, internal documents, or sensitive URLs unless you remove or disable the logging behavior and periodically delete any saved history.
Capability Assessment
Purpose & Capability
The artifact consistently describes a reading assistant that summarizes pasted text or user-provided URLs into main idea, arguments, actions, and questions.
Instruction Scope
The Python example automatically logs each extraction, but that behavior is disclosed in the feature list as saving reading records to a knowledge base.
Install Mechanism
The package contains a single non-executable SKILL.md file, with no install scripts, dependencies beyond Python standard library examples, or hidden setup behavior.
Credentials
Fetching user-provided URLs and writing a local JSON reading log are proportionate to the stated reading and knowledge-base purpose, though users should be aware of local retention.
Persistence & Privilege
The sample implementation writes source identifiers, timestamps, statistics, and extracted snippets to reading_log.json without an explicit no-save mode or retention controls.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install laosi-reading-assistant
  3. After installation, invoke the skill by name or use /laosi-reading-assistant
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release of Reading Assistant - 阅读助手. - Summarizes any text or webpage into four points: main idea, key arguments, action items, open questions. - Supports both plain text input and automatic web page extraction via URL. - Automatically logs reading summaries to a local knowledge base. - Output is structured, concise, and suitable for quick understanding without reading the full original. - Example code and usage scenarios included for easy integration.
Metadata
Slug laosi-reading-assistant
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is 阅读助手?

阅读助手 - 贴链接或粘贴文字,自动提炼4点:主旨/论据/行动/疑问,不用读全文。支持网页抓取和本地文本. It is an AI Agent Skill for Claude Code / OpenClaw, with 26 downloads so far.

How do I install 阅读助手?

Run "/install laosi-reading-assistant" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 阅读助手 free?

Yes, 阅读助手 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 阅读助手 support?

阅读助手 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 阅读助手?

It is built and maintained by 534422530 (@534422530); the current version is v1.0.0.

💬 Comments