princezuda/safestclaw

GitHub: princezuda/safestclaw

一个不强制依赖大语言模型、默认零成本离线运行的个人智能助手,用传统 ML 和规则引擎实现语音交互、新闻聚合、社交监控、研究检索和博客发布等功能。

Stars: 270 | Forks: 31

# SafestClaw 🐾 **OpenClaw 的零成本替代方案。不强制要求 LLM(但可选)。无强制 API 费用。极小的攻击面。可在任何机器上运行。** SafestClaw 使用 VADER、spaCy、sumy、YOLO、Whisper、Piper 及其他久经考验的机器学习技术,而非生成式 AI。其结果是:具备确定性、可预测、注重隐私且完全免费运行。 ## 为什么选择 SafestClaw? | | SafestClaw | OpenClaw | |---|---|---| | **默认每月费用** | **$0** | $100–$3,600+ | | **需要 LLM** | 否(可选;AI 博客、编码和研究均有不使用 LLM 的选项) | 是 | | **Prompt 注入风险** | **极小**(仅当您访问的 URL 是恶意时) | 是(无处不在) | | **离线工作** | **是**,除天气外的所有默认功能 | 否 | | **可在任何机器上运行** | **是**(Linux, macOS, Windows) | 需要强大的硬件或云 API | | **确定性输出** | **是** | 否(LLM 响应会有差异) | | **隐私** | **默认本地运行**(仅当您请求或设置了 LLM 时才会访问外部,例如天气) | 数据始终发送至 API 提供商 | ## 全面对比:SafestClaw vs OpenClaw | 功能 | SafestClaw | OpenClaw | |---|---|---| | 自托管 | ✅ | ✅ | | 跨平台 (Linux, macOS, Windows) | ✅ | ✅ | | 无需 AI/LLM | ✅ | ❌ | | 支持离线 | ✅ | ❌ | | 零 API 成本 | ✅ | ❌ | | Prompt 注入风险 | **极小**(仅限 LLM 研究) | 无处不在 | | 隐私优先 | ✅(默认本地运行) | ✅ | | 语音 (STT/TTS) | ✅ (Whisper + Piper,本地) | ✅ (ElevenLabs,付费 API) | | 智能家居控制 | ✅ | ✅(通过 skills) | | 蓝牙控制 | ✅ | ❌ | | 网络扫描 | ✅ | ❌ | | 社交媒体摘要 | ✅ (Twitter, Mastodon, Bluesky) | ❌(需要单独的 skills) | | 多渠道 | ✅ (CLI, Telegram, Webhooks) | ✅(13+ 个平台) | | 网页爬虫 | ✅ | ✅ | | 摘要生成 | ✅(抽取式) | ✅(AI 生成) | | RSS/新闻源 | ✅(50+ 个订阅源) | ✅(通过 skills) | | 情感分析 | ✅ (VADER) | ✅ (AI) | | 电子邮件集成 | ✅ | ✅ | | 日历支持 | ✅ | ✅ | | 文档阅读 | ✅ | ✅ | | 桌面通知 | ✅ | ✅ | | 物体检测 | ✅ (YOLO) | ❌ | | OCR | ✅ (Tesseract) | ❌ | | 定时任务 | ✅ | ✅ | | Webhooks | ✅ | ✅ | | 插件系统 | ✅ | ✅(5,700+ 个 skills) | | 自由聊天 | ❌ | ✅ | | 使用和不使用 LLM 进行博客创作 | ✅ 无 LLM(抽取式标题),有 LLM 时为 AI 博客 | ❌(始终需要 AI) | 博客发布 (WordPress, Joomla, SFTP) | ✅ | ❌(需要插件) | | 写作风格学习 | ✅(统计分析) | ❌ | | 学术研究 (arXiv, Scholar) | ✅(免费,无需 API key) | ❌ | | Wolfram Alpha | ✅(计算知识) | ❌ | | 简单设置(输入 key 或本地)简单的 telegram 和博客设置 | ✅(一条命令) | ❌ | | 从错误中自动学习 | ✅(单词转数字、拼写纠正) | ❌ | | 研究流水线 | ✅(两阶段,LLM 可选) | ✅(仅限 AI) | | 代码模板与工具 | ✅(7 个模板,离线工具) | ❌(需要 AI) | | 自动博客调度 | ✅(基于 cron) | ❌ | | 感知任务的提示词 | ✅(按任务路由 LLM) | ✅ | | 命令链 | ✅("read email and remind me at 3pm") | ✅ | | 自主多步任务 | ❌ | ✅ | | 自编写 skills | ❌ | ✅ | | 浏览器自动化 | ❌ | ✅ | ## 功能特性 ### 🗣️ 语音控制 * **语音转文字** — Whisper STT 在本地运行,无需云端转录 * **文字转语音** — Piper TTS 提供自然的语音输出,完全离线 * **语音优先工作流** — 像使用任何助手一样与 SafestClaw 对话 ### 🏠 智能家居与设备控制 * **智能家居集成** — 控制您的已连接设备 * **蓝牙设备控制** — 发现并管理蓝牙设备 * **网络扫描** — 在局域网中发现设备 ### 📱 社交媒体情报 * **Twitter/X 摘要** — 添加账号,获取其活动摘要 * **Mastodon 摘要** — 关注并总结联邦宇宙账号 * **Bluesky 摘要** — 跟踪并总结 Bluesky 信息流 * 无需 API token 即可获取公开内容 ### 📰 RSS 新闻聚合 * **50+ 个预设订阅源** — Hacker News, Ars Technica, BBC, Reuters, Nature 等 * **8 个分类** — 科技、国际、科学、商业、编程、安全、Linux、AI * **自定义订阅源** — 导入任何 RSS/Atom 订阅源 * **自动摘要** — 使用 sumy 进行抽取式摘要(无 AI) * **按用户偏好** — 自定义您的新闻来源 ### 🔒 隐私与安全 * **默认自托管** — 除非您明确请求外部信息(如天气),否则您的数据保留在本地 * **无需 API key** — 核心功能完全离线运行 * **无云 AI 依赖** — 不会将 token 发送到 OpenAI、Anthropic 或 Google * **极小的 Prompt 注入面** — 核心功能(博客、编码、命令)使用基于规则的解析,完全无需 LLM,因此它们对 Prompt 注入免疫。研究和深度分析*可以*选择使用 LLM 来合成来源——启用时,来自外部来源(arXiv 摘要、网页)的内容会被输入到 LLM,这带有极小的 Prompt 注入风险。第一阶段研究(收集/总结)从不使用 LLM,是安全的。我们对此权衡保持透明。 ### 📡 多渠道 * **CLI** — 具有 Rich 格式化的交互式命令行 * **Telegram** — 完整的机器人集成 * **Discord** — 即将推出 * **Slack** — 即将推出 * **Webhooks** — 入站和出站支持 ### ⚡ 自动化 * **命令链** — 自然地组合操作:“阅读我的电子邮件并在下午 3 点提醒我” * **网页爬取** — 具有深度限制和域过滤的异步爬取 * **摘要** — LexRank、TextRank、LSA、Luhn 算法 * **提醒** — 使用 dateparser 进行自然语言时间解析 * **Shell 命令** — 沙盒化的命令执行 * **文件操作** — 搜索、列出、读取文件 * **定时任务** — 计划任务自动化 * **每日简报** — 天气、提醒、来自您订阅源的新闻 ### 📊 文本分析 * **VADER 情感分析** — 基于词典的情感分析 * **关键词提取** — TF-IDF 风格的提取 * **可读性评分** — Flesch-Kincaid 指标 ### 📧 电子邮件集成 * **IMAP 支持** — 从 Gmail, Outlook, Yahoo 读取电子邮件 * **SMTP 支持** — 发送电子邮件 * **标准协议** — 无需 API key ### 📅 日历支持 * **ICS 文件** — 导入并解析 .ics 日历文件 * **CalDAV** — 连接到 Google Calendar, iCloud(可选) * **事件过滤** — 今天、即将到来、按日期范围 ### 📄 文档阅读 * **PDF** — 使用 PyMuPDF 进行文本提取 * **DOCX** — Microsoft Word 文档 * **HTML/Markdown/TXT** — 纯文本格式 ### 🔔 通知 * **桌面通知** — 跨平台 * **优先级** — 低、正常、高、紧急 * **速率限制** — 防止通知泛滥 ### 👁️ 可选机器学习功能 * **NLP** — spaCy 命名实体识别(约 50MB) * **视觉** — YOLO 物体检测 + OCR(约 2GB) * **OCR** — Tesseract 从图像中提取文本(轻量级) ### 🔬 真实研究来源 * **arXiv** — 跨计算机科学、数学、物理学、生物学等领域搜索学术论文(免费,无需 API key) * **Semantic Scholar** — 带有引用次数和作者信息的学术论文(免费,无需 API key) * **Wolfram Alpha** — 用于事实回答和计算的计算知识引擎 * **智能路由** — `research ` 一次搜索所有来源,或单独使用 `research arxiv`、`research scholar`、`research wolfram` * **两阶段流水线** — 第一阶段从真实研究来源收集($0),第二阶段进行可选的 LLM 深度分析 ### 🤖 超简单的 AI 设置 * **只需输入您的 key** — `setup ai sk-ant-your-key` 即可完成。自动检测 Anthropic、OpenAI、Google、Groq * **或者使用本地** — `setup ai local` 自动安装 Ollama,下载模型,并配置 SafestClaw * **模型预设** — `setup ai local small`(1.3GB)、`setup ai local coding`、`setup ai local writing` * **状态检查** — `setup ai status` 显示当前配置 * **零配置文件** — 无需编辑 YAML,命令会自动为您完成 ### 🧠 智能输入学习 * **单词转数字** — 输入“research select one two three”,SafestClaw 理解为“1 2 3” * **拼写自动纠正** — “remaind me” → “remind me”、“summerize” → “summarize” * **简写** — “tmrw” → “tomorrow”、“hrs” → “hours”、“mins” → “minutes” * **从错误中自动学习** — 如果命令执行失败并且您重新正确输入,SafestClaw 会记住该映射以备下次使用 * **无需 AI** — 所有纠正均基于规则且具确定性 ### 💬 可选的 LLM 命令理解 (NLU) 不想死记硬背命令语法?启用 NLU 桥接,只需自然地说话即可: ``` # 没有 NLU — 你必须知道确切的短语: remind me tomorrow at 9am to call the dentist # 启用 NLU — 任何表达方式均可: hey, can you remind me to call the dentist tomorrow morning at 9? I need a reminder for tomorrow at 9 to call the dentist put a 9am reminder tomorrow: dentist call ``` NLU 桥接使用您配置的 LLM(任何提供商)作为**纯翻译器**: 它将您输入的内容转换为最匹配的 SafestClaw 命令字符串, 然后像往常一样通过相同的基于规则的解析器。 LLM 从不直接执行任何操作——它只重新表述您的输入。 在 `config/config.yaml` 中启用: ``` safestclaw: nlu: enabled: true provider: my-claude # optional — uses active provider if omitted temperature: 0.0 # deterministic output show_translation: true # shows "_(understood as: remind me ...)_" prefix ``` **隐私提示:** 当启用 NLU 时,无法识别的命令将被发送到您配置的 LLM 提供商。已识别的命令(绝大多数)仍完全在本地处理,零 token 消耗。 ### ✍️ 写作风格分析器 * **学习您的口吻** — 将您的写作内容提供给 SafestClaw,它将构建一个包含 35 项指标的档案(句子长度、词汇、正式程度、缩写、结构、常用词等) * **持久记忆** — 您的档案存储在 SQLite 中,并随着每次样本输入不断改进 * **LLM 提示词生成** — 档案可转换为适用于任何 LLM 提供商的写作风格指令 * **无需 AI** — 所有分析均在本地使用 NLTK、VADER 和统计方法 ### 🔬 研究流水线 * **两阶段工作流** — 第一阶段收集并总结来源(无 LLM,$0)。第二阶段进行可选的 LLM 深度分析 * **来源收集** — 搜索 RSS 订阅源并爬取 URL,使用 Sumy 自动摘要 * **来源选择** — 您可以在任何 token 之前选择重要的来源 * **深度分析** — 可选的 LLM 通过结构化输出分析选定的来源 ### 💻 编码工具箱 * **7 个模板** — python-script、python-class、python-test、fastapi-endpoint、html-page、dockerfile、github-action * **代码统计** — 按语言统计任何目录的代码行数 * **正则表达式测试器** — 测试并解释正则表达式,带有匹配高亮 * **代码搜索** — 跨代码文件的正则表达式搜索 * **文件差异对比** — 并排比较两个文件 * **LLM 驱动(可选)** — 生成、解释、审查、重构、编写代码文档 ### 📅 自动博客调度器 * **Cron 调度** — 使用 cron 表达式安排定期的博客生成 * **来源分类** — 自动从特定的 RSS 类别拉取内容 * **异步安全** — 检测调度器类型不匹配并清晰地发出警告,而不是静默失败 ### 🧠 智能提示词构建器 * **感知任务的提示词** — 为博客、研究和编码任务生成优化的提示词 * **写作档案集成** — 自动将您的写作风格注入到博客提示词中 * **提供商路由** — 每种任务类型可以使用不同的 LLM 提供商 * **流程图** — `show me the flow` 以 ASCII 艺术形式显示完整架构 ### 🥚 彩蛋 * 内置个性和隐藏的惊喜——因为工具也应该是有趣的 ### 📝 博客创作 — 双模式 **确定性博客(无 AI,无费用):** * **撰写博客新闻** — 使用自然语言添加条目:“write blog news We shipped faster crawling today.” * **爬取网站获取内容** — “crawl https://example.com for title content”、“crawl example.com for body content” * **自动生成标题** — 抽取式摘要挑选最具代表性的内容作为您的标题。没有 LLM,只有数学计算。 * **纯 .txt 输出** — 您的博客是一个简单的文本文件,可以在任何地方分享 **AI 博客(可选,多提供商):** * **从主题生成完整文章** — “ai blog generate about sustainable technology” * **重写、扩充、润色** — “ai rewrite blog”、“ai expand blog” * **AI 标题和 SEO** — “ai headlines”、“ai blog seo” * **11 个提供商** — 5 个本地(Ollama、LM Studio、llama.cpp、LocalAI、Jan)+ 6 个云端(OpenAI、Anthropic、Google、Mistral、Groq、自定义) * **本地 AI = 免费 + 隐私** — 运行 Ollama 或 LM Studio,无需支付任何费用 **多平台发布:** * **WordPress** — REST API v2(支持 Application Passwords, JWT 或 Basic Auth) * **Joomla** — Web Services API(Joomla 4+) * **SFTP** — 将 HTML 上传至任何服务器 * **通用 API** — 将 JSON POST 到任何 endpoint * **首页管理** — 在任何目标平台上设置哪篇文章为首页 ## 安装说明 ### 使用 pipx(推荐) ``` # 如果需要,安装 pipx # Linux: sudo apt install pipx # macOS: brew install pipx # Windows (PowerShell): python -m pip install --user pipx python -m pipx ensurepath pipx ensurepath # 从本 repo 安装 SafestClaw pipx install git+https://github.com/princezuda/safestclaw.git ``` ### 使用 pip 配合虚拟环境 ``` # 创建并激活 venv # Linux/macOS: python3 -m venv ~/.safestclaw-venv source ~/.safestclaw-venv/bin/activate # Windows (PowerShell): python -m venv $HOME\.safestclaw-venv $HOME\.safestclaw-venv\Scripts\Activate.ps1 # 从本 repo 安装 SafestClaw pip install git+https://github.com/princezuda/safestclaw.git ``` ### 从源代码安装 ``` git clone https://github.com/princezuda/safestclaw.git cd safestclaw pip install -e . ``` ### 可选的机器学习功能 安装扩展的方式相同——用 git URL 替换 `safestclaw` 或使用 本地检出: ``` # 从本地 clone 安装(首先 cd 进入该 repo) pip install -e ".[nlp]" # spaCy NER (~50MB) pip install -e ".[vision]" # YOLO + OCR (~2GB, needs PyTorch) pip install -e ".[ocr]" # OCR only (needs Tesseract) pip install -e ".[ml]" # all ML extras # 或者直接从 GitHub 安装 pipx install "git+https://github.com/princezuda/safestclaw.git#egg=safestclaw[ml]" ``` **系统要求:** Python 3.11+,约 50MB 磁盘空间(基础版),视觉功能需额外约 2GB。支持在 Linux、macOS 和 Windows 上运行。 ## 快速入门 ``` # 启动交互模式 safestclaw # 或者启用 verbose 日志 safestclaw --verbose ``` ### 示例命令 ``` > news # Get headlines from enabled feeds > news tech # Get tech news only > news categories # See all available categories > news enable science # Enable science feeds > add feed https://blog.example.com/rss # Add custom feed > summarize https://news.ycombinator.com > crawl https://example.com > remind me to call mom tomorrow at 3pm > morning briefing # Includes news from your feeds! > check my email # View inbox (requires setup) > read my email and remind me at 3pm # Chain commands naturally > calendar today # Today's events from .ics > analyze sentiment of this text # VADER sentiment analysis > read document.pdf # Extract text from documents > write blog news We shipped a new feature today. # Blog entry (no AI) > crawl https://example.com for title content # Crawl for blog > blog title # Generate title from entries > publish blog # Save blog as .txt > blog # Interactive blog menu (AI or manual) > ai blog generate about home automation # AI writes a full post > ai rewrite blog # AI polishes your draft > publish blog to wp://mysite.com admin pass # Publish inline — no config needed > publish blog to my-wordpress # Or use a saved target from config > style learn I write concise, punchy posts. # Teach SafestClaw your style > style profile # View your writing profile > research WebAssembly performance # Search arXiv + Scholar + Wolfram > research arxiv quantum computing # Search arXiv papers directly > research scholar machine learning # Search Semantic Scholar > research wolfram integrate x^2 # Ask Wolfram Alpha > research select 1,2,3 # Pick sources to analyze > setup ai sk-ant-your-key-here # Enter your Anthropic key, done > setup ai local # Or auto-install Ollama (free!) > setup ai status # Check what's configured > code template python-class UserAuth Auth handler # Generate boilerplate > code templates # List all 7 templates > code stats src/ # Lines of code by language > code regex \d{3}-\d{4} test 555-1234 # Test regex > auto blog list # View scheduled auto-blogs > show me the flow # Architecture diagram > help ``` ### CLI 命令 ``` # 新闻 safestclaw news # Headlines from enabled categories safestclaw news tech # Tech news only safestclaw news --categories # List all categories safestclaw news world -n 20 # 20 world news headlines safestclaw news --add https://blog.example.com/rss --name "My Blog" safestclaw news -s # With auto-summarization # 摘要 safestclaw summarize https://example.com/article -n 5 # 抓取 safestclaw crawl https://example.com --depth 2 # 文本分析 safestclaw analyze "This product is amazing! I love it." safestclaw analyze document.txt --no-readability # 文档 safestclaw document report.pdf safestclaw document paper.docx --summarize -n 5 safestclaw document notes.md --output extracted.txt # 日历 safestclaw calendar import --file calendar.ics safestclaw calendar today safestclaw calendar upcoming --days 14 # 博客 — 确定性(无 AI) safestclaw blog help # Blog feature guide safestclaw blog write "New crawling features shipped today." safestclaw blog show # View draft and published posts safestclaw blog title # Generate title from entries safestclaw blog publish # Save blog as .txt safestclaw blog publish "My Custom Title" # Publish with custom title # 博客 — AI 驱动(需要配置中的 ai_providers) safestclaw blog # Interactive menu (AI or manual) # ai blog generate about # AI 撰写完整的博客文章 # ai rewrite blog # AI 润色你的草稿 # ai expand blog # AI 扩充篇幅 # ai headlines # AI 生成标题选项 # ai blog seo # AI 生成 SEO 元数据 # 发布(需要配置中的 publish_targets) # publish blog to my-wordpress # 发布到特定目标 # publish blog to all # 发布到所有目标 # set front page 123 on my-wp # 在目标上设置主页 # 写作风格 safestclaw style learn "I write short, punchy sentences. No fluff." safestclaw style profile # View your writing profile # 研究(arXiv, Semantic Scholar, Wolfram Alpha) safestclaw research "quantum computing" # Search all sources safestclaw research arxiv "transformer models" # arXiv papers safestclaw research scholar "deep learning" # Semantic Scholar safestclaw research wolfram "integrate x^2" # Wolfram Alpha safestclaw research sources # View gathered sources safestclaw research select 1,2,3 # Pick sources for deep analysis safestclaw research analyze # LLM deep dive (optional) # AI 设置(超级简单) safestclaw setup ai sk-ant-your-key # Enter Anthropic key, done safestclaw setup ai sk-your-key # Or OpenAI key safestclaw setup ai local # Or auto-install Ollama (free) safestclaw setup ai local coding # Install coding-optimized model safestclaw setup ai status # Check your setup # 编程工具箱 safestclaw code templates # List available templates safestclaw code template python-class UserAuth "Auth handler" safestclaw code stats src/ # Lines of code by language safestclaw code search "TODO" src/ # Regex search code files safestclaw code regex "\d{3}-\d{4}" test "555-1234" safestclaw code diff file1.py file2.py # 自动博客 safestclaw auto blog setup # Interactive setup wizard safestclaw auto blog list # View scheduled auto-blogs safestclaw auto blog remove my-blog # Remove a schedule # 工作流 safestclaw flow # Architecture diagram # Webhooks safestclaw webhook --port 8765 # 初始化 config safestclaw init ``` ## 配置说明 SafestClaw 会在 `config/config.yaml` 中查找配置: ``` safestclaw: name: "SafestClaw" language: "en" timezone: "UTC" channels: cli: enabled: true webhook: enabled: true port: 8765 telegram: enabled: false token: "YOUR_BOT_TOKEN" actions: shell: enabled: true sandboxed: true timeout: 30 files: enabled: true allowed_paths: - "~" ``` ## 写作风格与研究指南 ### 写作风格分析器 SafestClaw 通过分析文本样本来学习您的写作方式。它会构建一个统计档案——无需 AI。 ``` > style learn I've been thinking about this for a while. The tech industry loves to overcomplicate things. Simple solutions work better. Profile updated (1 sample analyzed). > style learn Here's what I learned from shipping 50 side projects: most of them failed. And that's completely fine! Profile updated (2 samples analyzed). > style profile Writing Style Profile (2 samples analyzed) Tone: casual, neutral Avg sentence: 7 words Vocabulary: advanced (richness: 72%) Structure: conversational Uses contractions, first person, em-dashes Favorite words: easier, simple, something, learn ``` 您的档案会在不同会话间持久保存,并自动塑造 AI 博客提示词,使生成的帖子听起来像您的语气。 **命令:** | 命令 | 描述 | |---|---| | `style learn ` | 向 SafestClaw 提供写作样本 | | `style profile` | 查看您当前的写作档案 | ### 研究流水线 两阶段研究:先收集(免费),然后可选地使用 AI 进行分析。 ``` > research WebAssembly performance Found 8 sources. Use 'research sources' to view. > research sources 1. [HN] WebAssembly 2.0 Performance Benchmarks (4 sentences) 2. [RSS] Wasm vs Native: A Deep Dive (3 sentences) ... > research select 1,2,5 Selected 3 sources for deep analysis. > research analyze [LLM analyzes your selected sources with structured output] ``` **命令:** | 命令 | 描述 | |---|---| | `research ` | 搜索订阅源并爬取来源(无 LLM) | | `research url ` | 添加特定 URL 作为来源 | | `research sources` | 查看收集到的来源及其摘要 | | `research select 1,2,3` | 选择用于深度分析的来源 | | `research analyze` | 对选定来源进行 LLM 深度分析 | | `research results` | 查看分析结果 | | `research help` | 显示所有研究命令 | ### 编码工具箱 离线编码实用工具以及可选的 LLM 驱动功能。 ``` > code templates python-script, python-class, python-test, fastapi-endpoint, html-page, dockerfile, github-action > code template python-class UserAuth Authentication handler @dataclass class UserAuth: """Authentication handler""" ... > code stats src/ python ████████████████████ 19,348 lines (55 files) 100% > code regex \d{3}-\d{4} test 555-1234 \d — digit (0-9) Match: 555-1234 ``` **命令:** | 命令 | 描述 | |---|---| | `code templates` | 列出所有 7 个可用模板 | | `code template [Name] [desc]` | 生成样板代码 | | `code stats ` | 按语言统计代码行数 | | `code search ` | 跨代码文件进行正则表达式搜索 | | `code read ` | 显示带有语法信息的文件 | | `code diff ` | 比较两个文件 | | `code regex [test]` | 测试并解释正则表达式 | | `code generate ` | LLM 生成代码(可选) | | `code explain ` | LLM 解释代码(可选) | | `code review ` | LLM 查找错误(可选) | | `code help` | 显示所有编码命令 | ### 自动博客调度器 使用 cron 表达式安排定期的博客生成。 ``` > auto blog setup [Interactive wizard] > auto blog add weekly-tech "0 9 * * 1" tech,ai Auto-blog 'weekly-tech' scheduled: 0 9 * * 1 > auto blog list weekly-tech: 0 9 * * 1 (tech, ai) > auto blog remove weekly-tech Removed. ``` ### 感知任务的提示词构建器 每种任务类型(博客、研究、编码)都会获得优化的提示词。配置按任务划分的 LLM 提供商: ``` task_providers: blog: "local-ollama" # Blog posts use local Ollama research: "openai" # Research uses OpenAI for quality coding: "local-lmstudio" # Code tasks use LM Studio ``` 运行 `show me the flow` 以查看完整的架构图。 ## 博客指南 SafestClaw 有两种博客模式。您可以使用其中一种,也可以同时使用。 ### 模式 1:确定性博客(无 AI) 手动编写条目,爬取网站获取内容,并让 SafestClaw 使用抽取式摘要(LexRank、TextRank、LSA、Luhn)生成标题。无需 API key,无费用,完全离线。 **设置:** 无需设置——开箱即用。 ``` > write blog news We shipped faster crawling today. Added entry (1 total). > crawl https://example.com for title content Extracted 3 titles, added to draft. > blog title Generated: "Faster Crawling Ships Today" > publish blog Saved: 2026-02-24-faster-crawling-ships-today.txt ``` **命令:** | 命令 | 描述 | |---|---| | `write blog news ` | 向您的草稿添加手动条目 | | `crawl for title content` | 将页面标题提取到草稿中 | | `crawl for body content` | 将主体文本提取到草稿中 | | `crawl for non-title content` | 将非标题文本提取到草稿中 | | `blog title` | 使用抽取式摘要生成标题 | | `show blog` | 查看您的草稿和已发布的帖子 | | `edit blog ` | 替换草稿内容 | | `publish blog` | 在本地保存为 `.txt` | | `publish blog My Custom Title` | 使用自定义标题保存 | ### 模式 2:AI 博客(可选) AI 根据主题生成完整的博客文章。您可以重写、扩充、生成标题并制作 SEO 元数据。支持 11 个提供商——5 个本地(免费)和 6 个云端(需要 API key)。 **设置:** 1. **选择提供商。** 如需免费/注重隐私,请使用本地提供商。如需追求质量/速度,请使用云端提供商。 2. **在 `config/config.yaml` 中的 `ai_providers` 下进行配置。** 取消注释并填写一项或多项: **本地 AI(免费,私密,无需 API key):** ``` ai_providers: # Ollama — easiest local option - label: "local-ollama" provider: "ollama" model: "llama3.1" endpoint: "http://localhost:11434/api/chat" # LM Studio — GUI app with model browser # - label: "local-lmstudio" # provider: "lm_studio" # model: "local-model" # endpoint: "http://localhost:1234/v1/chat/completions" # llama.cpp — high-performance C++ inference # - label: "local-llamacpp" # provider: "llamacpp" # model: "local-model" # endpoint: "http://localhost:8080/v1/chat/completions" # Jan — user-friendly desktop app # - label: "local-jan" # provider: "jan" # model: "llama3.1-8b" # endpoint: "http://localhost:1337/v1/chat/completions" ``` **云端 AI(需要 API key):** ``` ai_providers: # OpenAI - label: "openai" provider: "openai" api_key: "sk-..." # https://platform.openai.com/api-keys model: "gpt-4o" # Anthropic (Claude) # - label: "anthropic" # provider: "anthropic" # api_key: "sk-ant-..." # https://console.anthropic.com/settings/keys # model: "claude-sonnet-4-20250514" # Google Gemini # - label: "google" # provider: "google" # api_key: "AI..." # https://aistudio.google.com/apikey # model: "gemini-1.5-flash" # Mistral # - label: "mistral" # provider: "mistral" # api_key: "..." # https://console.mistral.ai/api-keys # model: "mistral-large-latest" # Groq (fast inference) # - label: "groq" # provider: "groq" # api_key: "gsk_..." # https://console.groq.com/keys # model: "llama-3.1-70b-versatile" ``` 3. **安装本地 AI 服务器**(如果使用本地): ``` # Ollama(推荐 — 一条命令) curl -fsSL https://ollama.com/install.sh | sh ollama pull llama3.1 # LM Studio — 从 https://lmstudio.ai 下载 # Jan — 从 https://jan.ai 下载 # llama.cpp — git clone https://github.com/ggerganov/llama.cpp && make ``` 4. **开始使用:** ``` > blog 1. AI Blog for You (Recommended) [ollama/llama3.1] 2. Manual Blogging (No AI) > 1 What should the blog post be about? > sustainable technology trends in 2026 AI-Generated Blog Post Provider: ollama/llama3.1 (847 tokens) --- [full article here] --- What would you like to do? edit blog - Replace with your edits ai rewrite blog - Have AI polish/rewrite it ai expand blog - Have AI make it longer publish blog - Save as .txt locally publish blog to wp://mysite.com u pass - Publish (shows preview first) publish blog to - Publish to configured target > publish blog to wp://mysite.com admin mypassword Ready to Publish Title: Sustainable Technology Trends in 2026 Words: 847 Target: wp-mysite.com Preview: The clean energy revolution is accelerating... ... [truncated] --- confirm - Publish now change title - Rename before publishing edit blog - Edit content first cancel - Abort > change title The Green Tech Surge: What's Coming in 2026 Title updated. Title: The Green Tech Surge: What's Coming in 2026 Target: wp-mysite.com Type confirm to publish or cancel to abort. > confirm Blog Published wp-mysite.com (wordpress): Post published successfully URL: https://mysite.com/the-green-tech-surge ``` **AI 命令:** | 命令 | 描述 | |---|---| | `blog` | 交互式菜单——选择 AI 或手动 | | `ai blog generate about ` | 从主题生成完整的博客文章 | | `ai rewrite blog` | 重写/润色您当前的草稿 | | `ai expand blog` | 将简短内容扩充为更长的文章 | | `ai headlines` | 为您的草稿生成 5 个标题选项 | | `ai blog seo` | 生成 SEO 元数据(标题、描述、关键词、slug) | | `ai options` | 显示本地 AI 提供商及安装说明 | | `ai providers` | 显示云端 AI 提供商及 API key 链接 | | `switch ai provider
标签:Apex, CLI, NLP, Piper, RSS订阅, spaCy, Splunk, STT, Telegram, TTS, VADER, Webhooks, Whisper, WiFi技术, YOLO, 云存储安全, 人工智能替代方案, 后渗透, 多模态交互, 安全防护, 开源, 意图识别, 抗提示注入, 插件系统, 文本摘要, 无线安全, 智能家居, 本地部署, 机器学习, 确定性输出, 离线运行, 网络安全, 网络扫描, 自托管, 蓝牙控制, 语音合成, 语音识别, 运行时操纵, 逆向工具, 隐私保护, 零成本, 非生成式AI