From 39738cc821e787ee766a91e275cfae5f43bb691f Mon Sep 17 00:00:00 2001 From: sansan <77180927+sansan0@users.noreply.github.com> Date: Tue, 25 Nov 2025 19:57:53 +0800 Subject: [PATCH] =?UTF-8?q?v3.4.0:=20=E6=96=B0=E5=A2=9E=20slack=20?= =?UTF-8?q?=E6=8E=A8=E9=80=81=EF=BC=8C=E4=BC=98=E5=8C=96=20setup-windows.b?= =?UTF-8?q?at=20=E4=B8=80=E9=94=AE=E5=AE=89=E8=A3=85=20MCP?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/crawler.yml | 1 + README-Cherry-Studio.md | 2 +- README-EN.md | 200 +++++++++++++++++++++++++++++++- README.md | 147 +++++++++++++++++++++-- config/config.yaml | 2 + docker/.env | 8 ++ docker/docker-compose-build.yml | 2 + docker/docker-compose.yml | 2 + setup-windows-en.bat | 129 ++++++++++++++------ setup-windows.bat | 139 ++++++++++++++++------ version | 2 +- 11 files changed, 544 insertions(+), 90 deletions(-) diff --git a/.github/workflows/crawler.yml b/.github/workflows/crawler.yml index 5714814..adb20f8 100644 --- a/.github/workflows/crawler.yml +++ b/.github/workflows/crawler.yml @@ -63,6 +63,7 @@ jobs: NTFY_SERVER_URL: ${{ secrets.NTFY_SERVER_URL }} NTFY_TOKEN: ${{ secrets.NTFY_TOKEN }} BARK_URL: ${{ secrets.BARK_URL }} + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} GITHUB_ACTIONS: true run: python main.py diff --git a/README-Cherry-Studio.md b/README-Cherry-Studio.md index d272716..8c912e1 100644 --- a/README-Cherry-Studio.md +++ b/README-Cherry-Studio.md @@ -65,7 +65,7 @@ cd 你的项目名 ### Windows 用户 -1. **双击运行**项目文件夹中的 `setup-windows.bat` +1. **双击运行**项目文件夹中的 `setup-windows.bat`,如果有问题,就运行 `setup-windows-en.bat` 2. **等待安装完成** 3. **记录显示的配置信息**(命令路径和参数) diff --git a/README-EN.md b/README-EN.md index 7bcb2e5..a7bc52c 100644 --- a/README-EN.md +++ b/README-EN.md @@ -14,7 +14,7 @@ [![GitHub Stars](https://img.shields.io/github/stars/sansan0/TrendRadar?style=flat-square&logo=github&color=yellow)](https://github.com/sansan0/TrendRadar/stargazers) [![GitHub Forks](https://img.shields.io/github/forks/sansan0/TrendRadar?style=flat-square&logo=github&color=blue)](https://github.com/sansan0/TrendRadar/network/members) [![License](https://img.shields.io/badge/license-GPL--3.0-blue.svg?style=flat-square)](LICENSE) -[![Version](https://img.shields.io/badge/version-v3.3.0-blue.svg)](https://github.com/sansan0/TrendRadar) +[![Version](https://img.shields.io/badge/version-v3.4.0-blue.svg)](https://github.com/sansan0/TrendRadar) [![MCP](https://img.shields.io/badge/MCP-v1.0.2-green.svg)](https://github.com/sansan0/TrendRadar) [![WeWork](https://img.shields.io/badge/WeWork-Notification-00D4AA?style=flat-square)](https://work.weixin.qq.com/) @@ -25,6 +25,7 @@ [![Email](https://img.shields.io/badge/Email-Notification-00D4AA?style=flat-square)](#) [![ntfy](https://img.shields.io/badge/ntfy-Notification-00D4AA?style=flat-square)](https://github.com/binwiederhier/ntfy) [![Bark](https://img.shields.io/badge/Bark-Notification-00D4AA?style=flat-square)](https://github.com/Finb/Bark) +[![Slack](https://img.shields.io/badge/Slack-Notification-00D4AA?style=flat-square)](https://slack.com/) [![GitHub Actions](https://img.shields.io/badge/GitHub_Actions-Automation-2088FF?style=flat-square&logo=github-actions&logoColor=white)](https://github.com/sansan0/TrendRadar) @@ -60,7 +61,7 @@ - Thanks to **followers**, your interactions make the content more meaningful 😎
-👉 Click to view Acknowledgments (Current 🔥72🔥 supporters) +👉 Click to view Acknowledgments (Current 🔥73🔥 supporters) ### Infrastructure Support @@ -90,6 +91,7 @@ After communication, the author indicated no concerns about server pressure, but | Supporter | Amount (CNY) | Date | Note | | :-------: | :----------: | :--: | :--: | +| D*5 | 1.8 * 3 | 2025.11.24 | | | *鬼 | 1 | 2025.11.17 | | | *超 | 10 | 2025.11.17 | | | R*w | 10 | 2025.11.17 | Great agent work! | @@ -270,6 +272,33 @@ Transform from "algorithm recommendation captivity" to "actively getting the inf - **Major Version Upgrade**: Upgrading from v1.x to v2.y, recommend deleting existing fork and re-forking to save effort and avoid config conflicts +### 2025/11/25 - v3.4.0 + +**🎉 Added Slack Push Support** + +1. **Team Collaboration Push Channel** + - Supports Slack Incoming Webhooks (globally popular team collaboration tool) + - Centralized message management, suitable for team-shared trending news + - Supports mrkdwn format (bold, links, etc.) + +2. **Multiple Deployment Methods** + - GitHub Actions: Configure `SLACK_WEBHOOK_URL` Secret + - Docker: Environment variable `SLACK_WEBHOOK_URL` + - Local: `config/config.yaml` configuration file + + +> 📖 **Detailed Configuration Tutorial**: [Quick Start - Slack Push](#-quick-start) + +- Optimized the one-click installation experience for setup-windows.bat and setup-windows-en.bat + +**🔧 Upgrade Instructions**: +- **GitHub Fork Users**: Update `main.py`, `config/config.yaml`, `.github/workflows/crawler.yml` + + +
+👉 Click to expand: Historical Updates + + ### 2025/11/24 - v3.3.0 **🎉 Added Bark Push Support** @@ -334,9 +363,6 @@ Transform from "algorithm recommendation captivity" to "actively getting the inf - Fix issue where today's news query may return articles from past dates -
-👉 Click to expand: Historical Updates - ### 2025/11/20 - v3.1.0 - **Added Personal WeChat Push Support**: WeWork application can push to personal WeChat without installing WeWork APP @@ -918,6 +944,7 @@ frequency_words.txt file added **required word** feature, using + sign | **Sina Mail** | sina.com | smtp.sina.com | 465 | SSL | | **Sohu Mail** | sohu.com | smtp.sohu.com | 465 | SSL | | **189 Mail** | 189.cn | smtp.189.cn | 465 | SSL | + | **Aliyun Mail** | aliyun.com | smtp.aliyun.com | 465 | TLS | > **Auto-detect**: When using above emails, no need to manually configure `EMAIL_SMTP_SERVER` and `EMAIL_SMTP_PORT`, system auto-detects. > @@ -927,6 +954,7 @@ frequency_words.txt file added **required word** feature, using + sign > > **Special Thanks**: > - Thanks to [@DYZYD](https://github.com/DYZYD) for contributing 189 Mail (189.cn) configuration and completing self-send-receive testing ([#291](https://github.com/sansan0/TrendRadar/issues/291)) + > - Thanks to [@longzhenren](https://github.com/longzhenren) for contributing Aliyun Mail (aliyun.com) configuration and completing testing ([#344](https://github.com/sansan0/TrendRadar/issues/344)) **Common Email Settings:** @@ -1078,6 +1106,162 @@ frequency_words.txt file added **required word** feature, using + sign
+
+ 👉 Click to expand: Bark Push (iOS exclusive, clean & efficient) +
+ + **GitHub Secret Configuration (⚠️ Name must be exact):** + - **Name**: `BARK_URL` (copy and paste this name, don't type manually) + - **Secret**: Your Bark push URL + +
+ + **Bark Introduction:** + + Bark is a free open-source push tool for iOS platform, featuring simplicity, speed, and no ads. + + **Usage Methods:** + + ### Method 1: Use Official Server (Recommended for beginners) 🆓 + + 1. **Download Bark App**: + - iOS: [App Store](https://apps.apple.com/us/app/bark-customed-notifications/id1403753865) + + 2. **Get Push URL**: + - Open Bark App + - Copy the push URL displayed on the home page (format: `https://api.day.app/your_device_key`) + - Configure the URL to GitHub Secrets as `BARK_URL` + + ### Method 2: Self-Hosted Server (Complete Privacy Control) 🔒 + + **Suitable for**: Users with servers, pursuing complete privacy, strong technical skills + + **Docker One-Click Deployment**: + ```bash + docker run -d \ + --name bark-server \ + -p 8080:8080 \ + finab/bark-server + ``` + + **Configure TrendRadar**: + ```yaml + BARK_URL: http://your-server-ip:8080/your_device_key + ``` + + --- + + **Notes:** + - ✅ Bark uses APNs push, max 4KB per message + - ✅ Supports automatic batch sending, no worry about long messages + - ✅ Push format is plain text (automatically removes Markdown syntax) + - ⚠️ Only supports iOS platform + + **Related Links:** + - [Bark Official Website](https://bark.day.app/) + - [Bark GitHub Repository](https://github.com/Finb/Bark) + - [Bark Server Self-Hosting Tutorial](https://github.com/Finb/bark-server) + +
+ +
+ 👉 Click to expand: Slack Push +
+ + **GitHub Secret Configuration (⚠️ Name must be exact):** + - **Name**: `SLACK_WEBHOOK_URL` (copy and paste this name, don't type manually) + - **Secret**: Your Slack Incoming Webhook URL + +
+ + **Slack Introduction:** + + Slack is a team collaboration tool, Incoming Webhooks can push messages to Slack channels. + + **Setup Steps:** + + ### Step 1: Create Slack App + + 1. **Visit Slack API Page**: + - Open https://api.slack.com/apps?new_app=1 + - Login to your Slack workspace if not logged in + + 2. **Choose Creation Method**: + - Click **"From scratch"** + + 3. **Fill in App Information**: + - **App Name**: Enter app name (e.g., `TrendRadar` or `Hot News Monitor`) + - **Workspace**: Select your workspace from dropdown + - Click **"Create App"** button + + ### Step 2: Enable Incoming Webhooks + + 1. **Navigate to Incoming Webhooks**: + - Find and click **"Incoming Webhooks"** in left menu + + 2. **Enable Feature**: + - Find **"Activate Incoming Webhooks"** toggle + - Switch from `OFF` to `ON` + - Page will auto-refresh showing new configuration options + + ### Step 3: Generate Webhook URL + + 1. **Add New Webhook**: + - Scroll to page bottom + - Click **"Add New Webhook to Workspace"** button + + 2. **Select Target Channel**: + - System will show authorization page + - Select channel to receive messages from dropdown (e.g., `#hot-news`) + - ⚠️ For private channels, must join the channel first + + 3. **Authorize App**: + - Click **"Allow"** button to complete authorization + - System will auto-redirect back to config page + + ### Step 4: Copy and Save Webhook URL + + 1. **View Generated URL**: + - In "Webhook URLs for Your Workspace" section + - You'll see the newly generated Webhook URL + - Format: `https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX` + + 2. **Copy URL**: + - Click **"Copy"** button on the right of URL + - Or manually select and copy URL + + 3. **Configure to TrendRadar**: + - **GitHub Actions**: Add URL to GitHub Secrets as `SLACK_WEBHOOK_URL` + - **Local Testing**: Fill URL in `config/config.yaml` `slack_webhook_url` field + - **Docker Deployment**: Add URL to `docker/.env` file as `SLACK_WEBHOOK_URL` variable + + --- + + **Notes:** + - ✅ Supports Markdown format (auto-converts to Slack mrkdwn) + - ✅ Supports automatic batch sending (4KB per batch) + - ✅ Suitable for team collaboration, centralized message management + - ⚠️ Webhook URL contains secret key, never make it public + + **Message Format Preview:** + ``` + *[Batch 1/2]* + + 📊 *Trending Topics Statistics* + + 🔥 *[1/3] AI ChatGPT* : 2 articles + + 1. [Baidu Hot] 🆕 ChatGPT-5 Official Release *[1]* - 09:15 (1 time) + + 2. [Toutiao] AI Chip Stocks Surge *[3]* - [08:30 ~ 10:45] (3 times) + ``` + + **Related Links:** + - [Slack Incoming Webhooks Official Docs](https://api.slack.com/messaging/webhooks) + - [Slack API App Management](https://api.slack.com/apps) + +
+ > **💡 Beginner Quick Start Tip**: > > For first deployment, suggest completing **GitHub Secrets** configuration first (choose one push platform), then jump to [Step 3] to test push success. @@ -1330,7 +1514,7 @@ Meizu !second-hand ``` -��� **Recommended:** Split into precise groups +**Recommended:** Split into precise groups ```txt Huawei OPPO @@ -1804,6 +1988,10 @@ Cherry Studio provides GUI config interface, 5-minute quick deployment, complex **Detailed Deployment Tutorial**: [README-Cherry-Studio.md](README-Cherry-Studio.md) +**Deployment Mode Description**: +- **STDIO Mode (Recommended)**: One-time configuration, no need to reconfigure later. The **illustrated deployment tutorial** only demonstrates this mode's configuration. +- **HTTP Mode (Alternative)**: If STDIO mode configuration encounters issues, you can use HTTP mode. This mode's configuration is basically the same as STDIO, but only requires copy-pasting one line, less error-prone. The only thing to note is that you need to manually start the service before each use. For details, refer to the HTTP mode section at the bottom of [README-Cherry-Studio.md](README-Cherry-Studio.md). + ### 2. Learning to Talk with AI **Detailed Conversation Tutorial**: [README-MCP-FAQ.md](README-MCP-FAQ.md) diff --git a/README.md b/README.md index a4f6102..5c36243 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ [![GitHub Stars](https://img.shields.io/github/stars/sansan0/TrendRadar?style=flat-square&logo=github&color=yellow)](https://github.com/sansan0/TrendRadar/stargazers) [![GitHub Forks](https://img.shields.io/github/forks/sansan0/TrendRadar?style=flat-square&logo=github&color=blue)](https://github.com/sansan0/TrendRadar/network/members) [![License](https://img.shields.io/badge/license-GPL--3.0-blue.svg?style=flat-square)](LICENSE) -[![Version](https://img.shields.io/badge/version-v3.3.0-blue.svg)](https://github.com/sansan0/TrendRadar) +[![Version](https://img.shields.io/badge/version-v3.4.0-blue.svg)](https://github.com/sansan0/TrendRadar) [![MCP](https://img.shields.io/badge/MCP-v1.0.2-green.svg)](https://github.com/sansan0/TrendRadar) [![企业微信通知](https://img.shields.io/badge/企业微信-通知-00D4AA?style=flat-square)](https://work.weixin.qq.com/) @@ -22,9 +22,10 @@ [![Telegram通知](https://img.shields.io/badge/Telegram-通知-00D4AA?style=flat-square)](https://telegram.org/) [![dingtalk通知](https://img.shields.io/badge/钉钉-通知-00D4AA?style=flat-square)](#) [![飞书通知](https://img.shields.io/badge/飞书-通知-00D4AA?style=flat-square)](https://www.feishu.cn/) -[![邮件通知](https://img.shields.io/badge/Email-通知-00D4AA?style=flat-square)](#) +[![邮件通知](https://img.shields.io/badge/Email-通知-00D4AA?style=flat-square)](#) [![ntfy通知](https://img.shields.io/badge/ntfy-通知-00D4AA?style=flat-square)](https://github.com/binwiederhier/ntfy) [![Bark通知](https://img.shields.io/badge/Bark-通知-00D4AA?style=flat-square)](https://github.com/Finb/Bark) +[![Slack通知](https://img.shields.io/badge/Slack-通知-00D4AA?style=flat-square)](https://slack.com/) [![GitHub Actions](https://img.shields.io/badge/GitHub_Actions-自动化-2088FF?style=flat-square&logo=github-actions&logoColor=white)](https://github.com/sansan0/TrendRadar) @@ -336,6 +337,33 @@ GitHub 一键 Fork 即可使用,无需编程基础。 - **大版本升级**:从 v1.x 升级到 v2.y,建议删除现有 fork 后重新 fork,这样更省力且避免配置冲突 +### 2025/11/25 - v3.4.0 + +**🎉 新增 Slack 推送支持** + +1. **团队协作推送渠道** + - 支持 Slack Incoming Webhooks(全球流行的团队协作工具) + - 消息集中管理,适合团队共享热点资讯 + - 支持 mrkdwn 格式(粗体、链接等) + +2. **多种部署方式** + - GitHub Actions:配置 `SLACK_WEBHOOK_URL` Secret + - Docker:环境变量 `SLACK_WEBHOOK_URL` + - 本地运行:`config/config.yaml` 配置文件 + + +> 📖 **详细配置教程**:[快速开始 - Slack 推送](#-快速开始) + +- 优化 setup-windows.bat 和 setup-windows-en.bat 一键安装 MCP 的体验 + +**🔧 升级说明**: +- **GitHub Fork 用户**:更新 `main.py`、`config/config.yaml`、`.github/workflows/crawler.yml` + + +
+👉 点击展开:历史更新 + + ### 2025/11/24 - v3.3.0 **🎉 新增 Bark 推送支持** @@ -358,11 +386,6 @@ GitHub 一键 Fork 即可使用,无需编程基础。 **🔧 升级说明**: - **GitHub Fork 用户**:更新 `main.py`、`config/config.yaml`、`.github/workflows/crawler.yml` - -
-👉 点击展开:历史更新 - - ### 2025/11/23 - v3.2.0 **🎯 新增高级定制功能** @@ -1191,6 +1214,104 @@ frequency_words.txt 文件增加了一个【必须词】功能,使用 + 号
+
+ 👉 点击展开:Slack 推送 +
+ + **GitHub Secret 配置(⚠️ Name 名称必须严格一致):** + - **Name(名称)**:`SLACK_WEBHOOK_URL`(请复制粘贴此名称,不要手打) + - **Secret(值)**:你的 Slack Incoming Webhook URL + +
+ + **Slack 简介:** + + Slack 是团队协作工具,Incoming Webhooks 可以将消息推送到 Slack 频道。 + + **设置步骤:** + + ### 步骤 1:创建 Slack App + + 1. **访问 Slack API 页面**: + - 打开 https://api.slack.com/apps?new_app=1 + - 如果未登录,先登录你的 Slack 工作空间 + + 2. **选择创建方式**: + - 点击 **"From scratch"**(从头开始创建) + + 3. **填写 App 信息**: + - **App Name**:填写应用名称(如 `TrendRadar` 或 `热点新闻监控`) + - **Workspace**:从下拉列表选择你的工作空间 + - 点击 **"Create App"** 按钮 + + ### 步骤 2:启用 Incoming Webhooks + + 1. **导航到 Incoming Webhooks**: + - 在左侧菜单中找到并点击 **"Incoming Webhooks"** + + 2. **启用功能**: + - 找到 **"Activate Incoming Webhooks"** 开关 + - 将开关从 `OFF` 切换到 `ON` + - 页面会自动刷新显示新的配置选项 + + ### 步骤 3:生成 Webhook URL + + 1. **添加新的 Webhook**: + - 滚动到页面底部 + - 点击 **"Add New Webhook to Workspace"** 按钮 + + 2. **选择目标频道**: + - 系统会弹出授权页面 + - 从下拉列表中选择要接收消息的频道(如 `#热点新闻`) + - ⚠️ 如果要选择私有频道,必须先加入该频道 + + 3. **授权应用**: + - 点击 **"Allow"** 按钮完成授权 + - 系统会自动跳转回配置页面 + + ### 步骤 4:复制并保存 Webhook URL + + 1. **查看生成的 URL**: + - 在 "Webhook URLs for Your Workspace" 区域 + - 会看到刚刚生成的 Webhook URL + - 格式如:`https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX` + + 2. **复制 URL**: + - 点击 URL 右侧的 **"Copy"** 按钮 + - 或手动选中 URL 并复制 + + 3. **配置到 TrendRadar**: + - **GitHub Actions**:将 URL 添加到 GitHub Secrets 中的 `SLACK_WEBHOOK_URL` + - **本地测试**:将 URL 填入 `config/config.yaml` 的 `slack_webhook_url` 字段 + - **Docker 部署**:将 URL 添加到 `docker/.env` 文件的 `SLACK_WEBHOOK_URL` 变量 + + --- + + **注意事项:** + - ✅ 支持 Markdown 格式(自动转换为 Slack mrkdwn) + - ✅ 支持自动分批推送(每批 4KB) + - ✅ 适合团队协作,消息集中管理 + - ⚠️ Webhook URL 包含密钥,切勿公开 + + **消息格式预览:** + ``` + *[第 1/2 批次]* + + 📊 *热点词汇统计* + + 🔥 *[1/3] AI ChatGPT* : 2 条 + + 1. [百度热搜] 🆕 ChatGPT-5正式发布 *[1]* - 09时15分 (1次) + + 2. [今日头条] AI芯片概念股暴涨 *[3]* - [08时30分 ~ 10时45分] (3次) + ``` + + **相关链接:** + - [Slack Incoming Webhooks 官方文档](https://api.slack.com/messaging/webhooks) + - [Slack API 应用管理](https://api.slack.com/apps) + +
+ 3. **手动测试新闻推送**: > 💡 **完成第1-2步后,请立即测试!** 测试成功后再根据需要调整配置(第4步)。 @@ -1276,7 +1397,9 @@ platforms: name: "华尔街见闻" # 添加更多平台... ``` -如果不会看的话,就直接复制他人整理好的部分[平台配置](https://github.com/sansan0/TrendRadar/issues/95) +如果不会看的话,可以有选择的复制他人整理好的部分[平台配置](https://github.com/sansan0/TrendRadar/issues/95) + +> 💡 平台不是越多越好,别贪心大量信息,你要进行筛选,否则依然只会被大量信息淹没。
@@ -1900,18 +2023,20 @@ AI 分析功能**不是**直接查询网络实时数据,而是分析你**本 ### 1. 快速部署 -Cherry Studio 提供 GUI 配置界面, 5 分钟快速部署, 复杂的部分是一键安装的。 +Cherry Studio 提供 GUI 配置界面,5 分钟快速部署,复杂的部分是一键安装的。 **图文部署教程**:现已更新到我的[公众号](#问题答疑与交流),回复 "mcp" 即可 **详细部署教程**:[README-Cherry-Studio.md](README-Cherry-Studio.md) +**部署模式说明**: +- **STDIO 模式(推荐)**:一次配置后续无需重复配置,**图文部署教程**中仅以此模式的配置为例。 +- **HTTP 模式(备选)**:如果 STDIO 模式配置遇到问题,可使用 HTTP 模式。此模式的配置方式与 STDIO 基本一致,但复制粘贴的内容就一行,不易出错。唯一需要注意的是每次使用前都需要手动启动一下服务。详细请参考 [README-Cherry-Studio.md](README-Cherry-Studio.md) 底部的 HTTP 模式说明。 + ### 2. 学习与 AI 对话的姿势 **详细对话教程**:[README-MCP-FAQ.md](README-MCP-FAQ.md) -**提问效果**: -
👉 点击展开:查看 AI 对话示例图
diff --git a/config/config.yaml b/config/config.yaml index 8441807..e2a4ee0 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -36,6 +36,7 @@ notification: dingtalk_batch_size: 20000 # 钉钉消息分批大小(字节)(这个配置也别动) feishu_batch_size: 29000 # 飞书消息分批大小(字节) bark_batch_size: 3600 # Bark消息分批大小(字节) + slack_batch_size: 4000 # Slack消息分批大小(字节) batch_send_interval: 3 # 批次发送间隔(秒) feishu_message_separator: "━━━━━━━━━━━━━━━━━━━" # feishu 消息分割线 @@ -86,6 +87,7 @@ notification: ntfy_topic: "" # ntfy主题名称 ntfy_token: "" # ntfy访问令牌(可选,用于私有主题) bark_url: "" # Bark推送URL(格式:https://api.day.app/your_device_key 或自建服务器地址) + slack_webhook_url: "" # Slack Incoming Webhook URL(格式:https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX) # 用于让关注度更高的新闻在更前面显示,即用算法重新组合不同平台的热搜排序形成你侧重的热搜,合起来是 1 就行 weight: diff --git a/docker/.env b/docker/.env index 6e59859..2c73e17 100644 --- a/docker/.env +++ b/docker/.env @@ -53,6 +53,14 @@ NTFY_TOPIC= # 可选:访问令牌(用于私有主题) NTFY_TOKEN= +# Bark 推送配置 +# Bark推送URL(格式:https://api.day.app/your_device_key 或自建服务器地址) +BARK_URL= + +# Slack 推送配置 +# Slack Incoming Webhook URL(格式:https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX) +SLACK_WEBHOOK_URL= + # ============================================ # 运行配置 # ============================================ diff --git a/docker/docker-compose-build.yml b/docker/docker-compose-build.yml index c241068..804e12d 100644 --- a/docker/docker-compose-build.yml +++ b/docker/docker-compose-build.yml @@ -43,6 +43,8 @@ services: - NTFY_TOKEN=${NTFY_TOKEN:-} # Bark配置 - BARK_URL=${BARK_URL:-} + # Slack配置 + - SLACK_WEBHOOK_URL=${SLACK_WEBHOOK_URL:-} # 运行模式 - CRON_SCHEDULE=${CRON_SCHEDULE:-*/5 * * * *} - RUN_MODE=${RUN_MODE:-cron} diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 6124cfc..206d7d3 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -41,6 +41,8 @@ services: - NTFY_TOKEN=${NTFY_TOKEN:-} # Bark配置 - BARK_URL=${BARK_URL:-} + # Slack配置 + - SLACK_WEBHOOK_URL=${SLACK_WEBHOOK_URL:-} # 运行模式 - CRON_SCHEDULE=${CRON_SCHEDULE:-*/5 * * * *} - RUN_MODE=${RUN_MODE:-cron} diff --git a/setup-windows-en.bat b/setup-windows-en.bat index 9edcdc6..35a9f8d 100644 --- a/setup-windows-en.bat +++ b/setup-windows-en.bat @@ -1,5 +1,4 @@ @echo off -:: 使用系统默认编码而不是强制 UTF-8 setlocal enabledelayedexpansion echo ========================================== @@ -7,13 +6,42 @@ echo TrendRadar MCP Setup (Windows) echo ========================================== echo: -REM Get current directory -set "PROJECT_ROOT=%CD%" +REM Fix: Use script location instead of current working directory +set "PROJECT_ROOT=%~dp0" +REM Remove trailing backslash +if "%PROJECT_ROOT:~-1%"=="\" set "PROJECT_ROOT=%PROJECT_ROOT:~0,-1%" + echo Project Directory: %PROJECT_ROOT% echo: +REM Change to project directory +cd /d "%PROJECT_ROOT%" +if %errorlevel% neq 0 ( + echo [ERROR] Cannot access project directory + pause + exit /b 1 +) + +REM Validate project structure +echo [0/4] Validating project structure... +if not exist "pyproject.toml" ( + echo [ERROR] pyproject.toml not found in: %PROJECT_ROOT% + echo: + echo This should not happen! Please check: + echo 1. Is setup-windows.bat in the project root? + echo 2. Was the project properly cloned/downloaded? + echo: + echo Files in current directory: + dir /b + echo: + pause + exit /b 1 +) +echo [OK] pyproject.toml found +echo: + REM Check Python -echo Checking Python... +echo [1/4] Checking Python... python --version >nul 2>&1 if %errorlevel% neq 0 ( echo [ERROR] Python not detected. Please install Python 3.10+ @@ -21,76 +49,106 @@ if %errorlevel% neq 0 ( pause exit /b 1 ) -echo Python OK +for /f "tokens=*" %%i in ('python --version') do echo [OK] %%i echo: REM Check UV -echo Checking UV... +echo [2/4] Checking UV... where uv >nul 2>&1 if %errorlevel% neq 0 ( - echo [1/3] UV not installed, installing automatically... + echo UV not installed, installing automatically... echo: - REM Use Bypass execution policy - powershell -ExecutionPolicy Bypass -Command "irm https://astral.sh/uv/install.ps1 | iex" + echo Trying installation method 1: PowerShell... + powershell -ExecutionPolicy Bypass -Command "try { irm https://astral.sh/uv/install.ps1 | iex; exit 0 } catch { Write-Host 'PowerShell method failed'; exit 1 }" if %errorlevel% neq 0 ( - echo [ERROR] UV installation failed echo: - echo Please install UV manually: - echo Method 1: Visit https://docs.astral.sh/uv/getting-started/installation/ - echo Method 2: Use pip install uv - pause - exit /b 1 + echo Method 1 failed. Trying method 2: pip... + python -m pip install --upgrade uv + + if %errorlevel% neq 0 ( + echo: + echo [ERROR] Automatic installation failed + echo: + echo Please install UV manually using one of these methods: + echo: + echo Method 1 - pip: + echo python -m pip install uv + echo: + echo Method 2 - pipx: + echo pip install pipx + echo pipx install uv + echo: + echo Method 3 - Manual download: + echo Visit: https://docs.astral.sh/uv/getting-started/installation/ + echo: + pause + exit /b 1 + ) ) echo: - echo [SUCCESS] UV installed successfully - echo [IMPORTANT] Please follow these steps: + echo [SUCCESS] UV installed successfully! + echo: + echo [IMPORTANT] Please restart your terminal: echo 1. Close this window - echo 2. Reopen Command Prompt or PowerShell - echo 3. Navigate to project directory: cd "%PROJECT_ROOT%" - echo 4. Run this script again: setup-windows.bat + echo 2. Open a new Command Prompt + echo 3. Navigate to: %PROJECT_ROOT% + echo 4. Run: setup-windows.bat echo: pause exit /b 0 ) else ( - echo [1/3] UV already installed - uv --version + for /f "tokens=*" %%i in ('uv --version') do echo [OK] %%i ) echo: -echo [2/3] Installing project dependencies... +echo [3/4] Installing dependencies... +echo Working directory: %PROJECT_ROOT% echo: -REM Install dependencies with UV +REM Ensure we're in the project directory +cd /d "%PROJECT_ROOT%" uv sync if %errorlevel% neq 0 ( + echo: echo [ERROR] Dependency installation failed echo: - echo Possible causes: - echo - Missing pyproject.toml file - echo - Network connection issues - echo - Incompatible Python version + echo Troubleshooting steps: + echo 1. Check your internet connection + echo 2. Verify Python version ^>= 3.10: python --version + echo 3. Try with verbose output: uv sync --verbose + echo 4. Check if pyproject.toml is valid + echo: + echo Project directory: %PROJECT_ROOT% + echo: pause exit /b 1 ) echo: +echo [OK] Dependencies installed successfully +echo: -echo [3/3] Checking configuration file... +echo [4/4] Checking configuration file... if not exist "config\config.yaml" ( - echo [WARNING] Configuration file not found: config\config.yaml + echo [WARNING] config\config.yaml not found if exist "config\config.example.yaml" ( - echo Tip: Example config found, please copy and modify: - echo copy config\config.example.yaml config\config.yaml + echo: + echo To create your configuration: + echo 1. Copy: copy config\config.example.yaml config\config.yaml + echo 2. Edit: notepad config\config.yaml + echo 3. Add your API keys ) echo: +) else ( + echo [OK] config\config.yaml exists ) +echo: REM Get UV path for /f "tokens=*" %%i in ('where uv 2^>nul') do set "UV_PATH=%%i" if not defined UV_PATH ( - echo [WARNING] Unable to get UV path, please find it manually set "UV_PATH=uv" ) @@ -99,7 +157,7 @@ echo ========================================== echo Setup Complete! echo ========================================== echo: -echo MCP Server Configuration: +echo MCP Server Configuration for Claude Desktop: echo: echo Command: %UV_PATH% echo Working Directory: %PROJECT_ROOT% @@ -112,6 +170,7 @@ echo python echo -m echo mcp_server.server echo: -echo Documentation: README-Cherry-Studio.md +echo Configuration guide: README-Cherry-Studio.md +echo: echo: pause \ No newline at end of file diff --git a/setup-windows.bat b/setup-windows.bat index 2e9ce08..d34f3fa 100644 --- a/setup-windows.bat +++ b/setup-windows.bat @@ -1,17 +1,48 @@ @echo off chcp 65001 >nul setlocal enabledelayedexpansion -echo ╔════════════════════════════════════════╗ -echo ║ TrendRadar MCP 一键部署 (Windows) ║ -echo ╚════════════════════════════════════════╝ + +echo ========================================== +echo TrendRadar MCP 一键部署 (Windows) +echo ========================================== echo. -REM 获取当前目录 -set "PROJECT_ROOT=%CD%" +REM 修复:使用脚本所在目录,而不是当前工作目录 +set "PROJECT_ROOT=%~dp0" +REM 移除末尾的反斜杠 +if "%PROJECT_ROOT:~-1%"=="\" set "PROJECT_ROOT=%PROJECT_ROOT:~0,-1%" + echo 📍 项目目录: %PROJECT_ROOT% echo. +REM 切换到项目目录 +cd /d "%PROJECT_ROOT%" +if %errorlevel% neq 0 ( + echo ❌ 无法访问项目目录 + pause + exit /b 1 +) + +REM 验证项目结构 +echo [0/4] 🔍 验证项目结构... +if not exist "pyproject.toml" ( + echo ❌ 未找到 pyproject.toml 文件: %PROJECT_ROOT% + echo. + echo 请检查: + echo 1. setup-windows.bat 是否在项目根目录? + echo 2. 项目文件是否完整? + echo. + echo 当前目录内容: + dir /b + echo. + pause + exit /b 1 +) +echo ✅ pyproject.toml 已找到 +echo. + REM 检查 Python +echo [1/4] 🐍 检查 Python... python --version >nul 2>&1 if %errorlevel% neq 0 ( echo ❌ 未检测到 Python,请先安装 Python 3.10+ @@ -19,84 +50,119 @@ if %errorlevel% neq 0 ( pause exit /b 1 ) +for /f "tokens=*" %%i in ('python --version') do echo ✅ %%i +echo. REM 检查 UV +echo [2/4] 🔧 检查 UV... where uv >nul 2>&1 if %errorlevel% neq 0 ( - echo [1/3] 🔧 UV 未安装,正在自动安装... + echo UV 未安装,正在自动安装... echo. - REM 使用 Bypass 执行策略 - powershell -ExecutionPolicy Bypass -Command "irm https://astral.sh/uv/install.ps1 | iex" + echo 尝试方法1: PowerShell 安装... + powershell -ExecutionPolicy Bypass -Command "try { irm https://astral.sh/uv/install.ps1 | iex; exit 0 } catch { Write-Host 'PowerShell 安装失败'; exit 1 }" if %errorlevel% neq 0 ( - echo ❌ UV 安装失败 echo. - echo 请手动安装 UV: - echo 方法1: 访问 https://docs.astral.sh/uv/getting-started/installation/ - echo 方法2: 使用 pip install uv - pause - exit /b 1 + echo 方法1失败,尝试方法2: pip 安装... + python -m pip install --upgrade uv + + if %errorlevel% neq 0 ( + echo. + echo ❌ 自动安装失败 + echo. + echo 请手动安装 UV,可选方法: + echo. + echo 方法1 - pip: + echo python -m pip install uv + echo. + echo 方法2 - pipx: + echo pip install pipx + echo pipx install uv + echo. + echo 方法3 - 手动下载: + echo 访问: https://docs.astral.sh/uv/getting-started/installation/ + echo. + pause + exit /b 1 + ) ) echo. - echo ✅ UV 安装完成 + echo ✅ UV 安装完成! + echo. echo ⚠️ 重要: 请按照以下步骤操作: echo 1. 关闭此窗口 echo 2. 重新打开命令提示符(或 PowerShell) - echo 3. 回到项目目录: cd "%PROJECT_ROOT%" + echo 3. 回到项目目录: %PROJECT_ROOT% echo 4. 重新运行此脚本: setup-windows.bat echo. pause exit /b 0 ) else ( - echo [1/3] ✅ UV 已安装 - uv --version + for /f "tokens=*" %%i in ('uv --version') do echo ✅ %%i ) - -echo. -echo [2/3] 📦 安装项目依赖... echo. -REM 使用 UV 安装依赖 +echo [3/4] 📦 安装项目依赖... +echo 工作目录: %PROJECT_ROOT% +echo. + +REM 确保在项目目录下执行 +cd /d "%PROJECT_ROOT%" uv sync if %errorlevel% neq 0 ( + echo. echo ❌ 依赖安装失败 echo. echo 可能的原因: - echo - 缺少 pyproject.toml 文件 - echo - 网络连接问题 - echo - Python 版本不兼容 + echo 1. 网络连接问题 + echo 2. Python 版本不兼容(需要 ^>= 3.10) + echo 3. pyproject.toml 文件格式错误 + echo. + echo 故障排查: + echo - 检查网络连接 + echo - 验证 Python 版本: python --version + echo - 尝试详细输出: uv sync --verbose + echo. + echo 项目目录: %PROJECT_ROOT% + echo. pause exit /b 1 ) - echo. -echo [3/3] ✅ 检查配置文件... +echo ✅ 依赖安装成功 +echo. +echo [4/4] ⚙️ 检查配置文件... if not exist "config\config.yaml" ( echo ⚠️ 配置文件不存在: config\config.yaml if exist "config\config.example.yaml" ( - echo 提示: 发现示例配置文件,请复制并修改: - echo copy config\config.example.yaml config\config.yaml + echo. + echo 创建配置文件: + echo 1. 复制: copy config\config.example.yaml config\config.yaml + echo 2. 编辑: notepad config\config.yaml + echo 3. 填入 API 密钥 ) echo. +) else ( + echo ✅ config\config.yaml 已存在 ) +echo. REM 获取 UV 路径 for /f "tokens=*" %%i in ('where uv 2^>nul') do set "UV_PATH=%%i" - if not defined UV_PATH ( - echo ⚠️ 无法获取 UV 路径,请手动查找 set "UV_PATH=uv" ) echo. -echo ╔════════════════════════════════════════╗ -echo ║ 部署完成! ║ -echo ╚════════════════════════════════════════╝ +echo ========================================== +echo 部署完成! +echo ========================================== echo. -echo 📋 MCP 服务器配置信息: +echo 📋 MCP 服务器配置信息(用于 Claude Desktop): echo. echo 命令: %UV_PATH% echo 工作目录: %PROJECT_ROOT% @@ -111,4 +177,5 @@ echo mcp_server.server echo. echo 📖 详细教程: README-Cherry-Studio.md echo. -pause +echo. +pause \ No newline at end of file diff --git a/version b/version index 0fa4ae4..fbcbf73 100644 --- a/version +++ b/version @@ -1 +1 @@ -3.3.0 \ No newline at end of file +3.4.0 \ No newline at end of file