From f3e57c71a8e2e1ade06bca00dc645958c9174a80 Mon Sep 17 00:00:00 2001 From: 23q3 <2335125256@qq.com> Date: Fri, 2 Jan 2026 00:28:49 +0800 Subject: [PATCH 1/8] =?UTF-8?q?docs:=20=E9=87=8D=E6=9E=84=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=97=A5=E5=BF=97=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 CHANGELOG.md 拆分为独立的版本文件 - 迁移 v1.0.0 至 v2.1.7 共 15 个版本日志 - 更新 README 中的更新日志链接指向 GitHub Releases --- CHANGELOG.md | 83 -------------------------------------------- README.md | 4 +-- changelogs/v1.0.0.md | 2 ++ changelogs/v1.0.1.md | 4 +++ changelogs/v1.0.2.md | 5 +++ changelogs/v1.0.3.md | 2 ++ changelogs/v1.0.4.md | 1 + changelogs/v2.0.0.md | 3 ++ changelogs/v2.0.1.md | 1 + changelogs/v2.1.0.md | 3 ++ changelogs/v2.1.1.md | 2 ++ changelogs/v2.1.2.md | 1 + changelogs/v2.1.3.md | 2 ++ changelogs/v2.1.4.md | 2 ++ changelogs/v2.1.5.md | 2 ++ changelogs/v2.1.6.md | 2 ++ changelogs/v2.1.7.md | 5 +++ 17 files changed, 38 insertions(+), 86 deletions(-) delete mode 100644 CHANGELOG.md create mode 100644 changelogs/v1.0.0.md create mode 100644 changelogs/v1.0.1.md create mode 100644 changelogs/v1.0.2.md create mode 100644 changelogs/v1.0.3.md create mode 100644 changelogs/v1.0.4.md create mode 100644 changelogs/v2.0.0.md create mode 100644 changelogs/v2.0.1.md create mode 100644 changelogs/v2.1.0.md create mode 100644 changelogs/v2.1.1.md create mode 100644 changelogs/v2.1.2.md create mode 100644 changelogs/v2.1.3.md create mode 100644 changelogs/v2.1.4.md create mode 100644 changelogs/v2.1.5.md create mode 100644 changelogs/v2.1.6.md create mode 100644 changelogs/v2.1.7.md diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index f061b95..0000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,83 +0,0 @@ -# 📋 更新日志 - -### v2.1.7 (2025-11-17) - -- 🐛 **修复AstrBot兼容性问题** - 移除对不存在的 `Anonymous` 等消息组件类的依赖,使用类型字符串检查替代类实例检查,兼容 AstrBot 新版本 -- ⚡ **优化私聊回复机制** - 将私聊回复概率固定为1,确保历史消息格式统一 -- ⚡ **优化引用消息显示** - 改进 Reply 组件处理,提供更完整的发送者信息和内容 -- ⚡ **优化@消息处理** - 重构 'at' 和 'atall' 组件处理逻辑,提高代码清晰度和功能性 -- [#72](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/72) [#73](https://github.com/23q3/astrbot_plugin_SpectreCore/pull/73) @Hola-Gracias - -### v2.1.6 (2025-10-13) - -- 🐛 **修复空消息异常** - 修复napcat发送私聊"正在输入"状态时,导致插件异常的问题 [#70](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/70) -- 🐛 **修复代码问题并改进错误处理** - 修复装饰器参数位置错误、历史记录加载失败崩溃问题,改进路径处理和日志记录 - -### v2.1.5 (2025-09-03) - -- ✨ **新增临时禁言功能** - 添加闭嘴/说话指令,支持临时禁用自动回复功能,默认5分钟,可自定义时长 [#63](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/63) -- 🔒 **添加权限控制** - 对管理指令添加了管理员权限限制 - -### v2.1.4 (2025-06-28) - -- ✨ **为LLM回复添加限制条件** - 在结尾提示词中添加对于回复的限制,避免LLM使用[At:id(昵称)]这样的格式 [#54](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/54)@Fossssss -- 🐛 **修复与其他插件的兼容性问题** - 移除AiocqhttpMessageEvent类型断言,使用安全检查和异常处理机制,解决其他插件构造输入时的报错问题 [#57](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/57) - -### v2.1.3 (2025-06-17) - -- ✨ **新增图片持久化存储功能** - 添加图片本地存储和自动清理机制,解决聊天记录中图片链接过期问题。新增 `enable_image_persistence` 和 `image_retention_days` 配置选项 [#52](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/52) -- 🐛 **修复读空气功能干扰命令执行的问题** - 将读空气处理逻辑从on_llm_response移至on_decorating_result阶段,避免在大模型回复后立即停止事件传播导致命令逻辑被中断 [#33](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/33) - -### v2.1.2 (2025-06-02) - -- 🐛 **修复Reply消息处理错误** - 修复在处理包含回复消息的历史记录时出现'Reply' object has no attribute 'sender_str'错误的问题 [#46](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/46) - -### v2.1.1 (2025-04-29) - -- ✨ **新增黑名单关键词功能** - 添加黑名单关键词配置,可以设置不触发回复的关键词 -- 🐛 **修复重置历史记录问题** - 修复重置聊天记录后提示消息被错误保存到历史记录的问题 [#41](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/41) - -### v2.1.0 (2025-04-12) - -- 🔄 **数据存储格式优化** - 使用jsonpickle库替换pickle,提高数据可读性和跨平台兼容性 -- 🐛 **修复Docker环境兼容性** - 采用JSON序列化格式,彻底解决Docker环境下消息历史存取问题 [#31](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/31) -- 🐛 **修复私聊时无法正确保存bot消息的问题** - 修复了在私聊场景下bot发送的消息无法被正确保存到历史记录的问题,确保私聊对话的完整性 - -### v2.0.1 (2025-04-11) - -- 🐛 **修复Docker部署问题** - 改进路径处理方式,修复在Docker环境下无法保存/读取消息历史的问题 - -### v2.0.0 (2025-04-08) - -- 🏗️ 完全重构 抛弃使用协议端API获取聊天记录的方式,改为基于Astrbot本身,支持了更多消息平台 [#21](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/21) [#4](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/4) -- 🔄 架构改进 采用高度模块化设计,每个功能封装在独立工具类中 -- 📸 图片转述 支持图片转述功能 [#16](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/16) - -### v1.0.4 (2025-03-12) - -- 🐛 修正处理大模型回复时的条件判断逻辑 [#15](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/15) - -### v1.0.3 (2025-03-11) - -- 🐛 在处理大模型回复时增加了对角色的判断,避免调用函数工具时出错 [#15](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/15) -- 🐛 在提示词增加了bot的昵称和qq号,避免大模型不知道聊天记录中哪个是自己 [#14](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/14) - -### v1.0.2 (2025-03-08) - -- 🔒 添加了群组锁机制,防止并发调用大模型 -- 🛠️ 优化了消息处理存储流程,极大提高了性能 -- 🔍 添加了清除聊天记录的指令 -- 🔍 添加了检测指令关键词不回复功能 -- 📝 改进了代码结构 - -### v1.0.1 (2025-03-05) - -- 🔍 增加了读空气功能 -- 🔍 增加了函数工具开关配置 -- 🔄 更换了request_llm方法调用大模型,提高兼容性 -- 🛠️ 优化部分代码 - -### v1.0.0 (2025-03-04) - -- 🎉 首次发布 -- ✨ 实现基本的群聊互动功能 diff --git a/README.md b/README.md index 892f12f..9aa59d5 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ SpectreCore (影芯) 是一个为 AstrBot 设计的高级群聊互动插件, - [指令说明](./docs/commands.md) - 详细的指令用法和参数说明 - [使用技巧](./docs/tips.md) - 提高插件使用效果的技巧和建议 - [项目结构](./docs/structure.md) - 项目代码结构和核心文件说明 -- [更新日志](./CHANGELOG.md) - 项目版本历史和功能变化 +- [更新日志](https://github.com/23q3/astrbot_plugin_SpectreCore/releases) - 项目版本历史和功能变化 ## 📋 最新版本 @@ -78,8 +78,6 @@ SpectreCore (影芯) 是一个为 AstrBot 设计的高级群聊互动插件, - ⚡ **优化@消息处理** - 重构 'at' 和 'atall' 组件处理逻辑,提高代码清晰度和功能性 - [#72](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/72) [#73](https://github.com/23q3/astrbot_plugin_SpectreCore/pull/73) @Hola-Gracias -查看完整的[更新日志](./CHANGELOG.md),了解项目的版本历史和功能变化。 - ## ⚠️ 注意事项 - 本插件和 AstrBot 自带的主动回复功能之间没有任何联系,在使用本插件时请关闭 AstrBot 的主动回复功能,以免重复回复 diff --git a/changelogs/v1.0.0.md b/changelogs/v1.0.0.md new file mode 100644 index 0000000..74659ff --- /dev/null +++ b/changelogs/v1.0.0.md @@ -0,0 +1,2 @@ +- 🎉 首次发布 +- ✨ 实现基本的群聊互动功能 diff --git a/changelogs/v1.0.1.md b/changelogs/v1.0.1.md new file mode 100644 index 0000000..9fdcbf0 --- /dev/null +++ b/changelogs/v1.0.1.md @@ -0,0 +1,4 @@ +- 🔍 增加了读空气功能 +- 🔍 增加了函数工具开关配置 +- 🔄 更换了request_llm方法调用大模型,提高兼容性 +- 🛠️ 优化部分代码 diff --git a/changelogs/v1.0.2.md b/changelogs/v1.0.2.md new file mode 100644 index 0000000..6d912a4 --- /dev/null +++ b/changelogs/v1.0.2.md @@ -0,0 +1,5 @@ +- 🔒 添加了群组锁机制,防止并发调用大模型 +- 🛠️ 优化了消息处理存储流程,极大提高了性能 +- 🔍 添加了清除聊天记录的指令 +- 🔍 添加了检测指令关键词不回复功能 +- 📝 改进了代码结构 diff --git a/changelogs/v1.0.3.md b/changelogs/v1.0.3.md new file mode 100644 index 0000000..6ecb51f --- /dev/null +++ b/changelogs/v1.0.3.md @@ -0,0 +1,2 @@ +- 🐛 在处理大模型回复时增加了对角色的判断,避免调用函数工具时出错 [#15](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/15) +- 🐛 在提示词增加了bot的昵称和qq号,避免大模型不知道聊天记录中哪个是自己 [#14](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/14) diff --git a/changelogs/v1.0.4.md b/changelogs/v1.0.4.md new file mode 100644 index 0000000..dde624d --- /dev/null +++ b/changelogs/v1.0.4.md @@ -0,0 +1 @@ +- 🐛 修正处理大模型回复时的条件判断逻辑 [#15](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/15) diff --git a/changelogs/v2.0.0.md b/changelogs/v2.0.0.md new file mode 100644 index 0000000..9f3b0e3 --- /dev/null +++ b/changelogs/v2.0.0.md @@ -0,0 +1,3 @@ +- 🏗️ 完全重构 抛弃使用协议端API获取聊天记录的方式,改为基于Astrbot本身,支持了更多消息平台 [#21](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/21) [#4](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/4) +- 🔄 架构改进 采用高度模块化设计,每个功能封装在独立工具类中 +- 📸 图片转述 支持图片转述功能 [#16](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/16) diff --git a/changelogs/v2.0.1.md b/changelogs/v2.0.1.md new file mode 100644 index 0000000..54ac812 --- /dev/null +++ b/changelogs/v2.0.1.md @@ -0,0 +1 @@ +- 🐛 **修复Docker部署问题** - 改进路径处理方式,修复在Docker环境下无法保存/读取消息历史的问题 diff --git a/changelogs/v2.1.0.md b/changelogs/v2.1.0.md new file mode 100644 index 0000000..98dd47d --- /dev/null +++ b/changelogs/v2.1.0.md @@ -0,0 +1,3 @@ +- 🔄 **数据存储格式优化** - 使用jsonpickle库替换pickle,提高数据可读性和跨平台兼容性 +- 🐛 **修复Docker环境兼容性** - 采用JSON序列化格式,彻底解决Docker环境下消息历史存取问题 [#31](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/31) +- 🐛 **修复私聊时无法正确保存bot消息的问题** - 修复了在私聊场景下bot发送的消息无法被正确保存到历史记录的问题,确保私聊对话的完整性 diff --git a/changelogs/v2.1.1.md b/changelogs/v2.1.1.md new file mode 100644 index 0000000..5735358 --- /dev/null +++ b/changelogs/v2.1.1.md @@ -0,0 +1,2 @@ +- ✨ **新增黑名单关键词功能** - 添加黑名单关键词配置,可以设置不触发回复的关键词 +- 🐛 **修复重置历史记录问题** - 修复重置聊天记录后提示消息被错误保存到历史记录的问题 [#41](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/41) diff --git a/changelogs/v2.1.2.md b/changelogs/v2.1.2.md new file mode 100644 index 0000000..5b77b61 --- /dev/null +++ b/changelogs/v2.1.2.md @@ -0,0 +1 @@ +- 🐛 **修复Reply消息处理错误** - 修复在处理包含回复消息的历史记录时出现'Reply' object has no attribute 'sender_str'错误的问题 [#46](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/46) diff --git a/changelogs/v2.1.3.md b/changelogs/v2.1.3.md new file mode 100644 index 0000000..a231e76 --- /dev/null +++ b/changelogs/v2.1.3.md @@ -0,0 +1,2 @@ +- ✨ **新增图片持久化存储功能** - 添加图片本地存储和自动清理机制,解决聊天记录中图片链接过期问题。新增 `enable_image_persistence` 和 `image_retention_days` 配置选项 [#52](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/52) +- 🐛 **修复读空气功能干扰命令执行的问题** - 将读空气处理逻辑从on_llm_response移至on_decorating_result阶段,避免在大模型回复后立即停止事件传播导致命令逻辑被中断 [#33](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/33) diff --git a/changelogs/v2.1.4.md b/changelogs/v2.1.4.md new file mode 100644 index 0000000..fc11984 --- /dev/null +++ b/changelogs/v2.1.4.md @@ -0,0 +1,2 @@ +- ✨ **为LLM回复添加限制条件** - 在结尾提示词中添加对于回复的限制,避免LLM使用[At:id(昵称)]这样的格式 [#54](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/54)@Fossssss +- 🐛 **修复与其他插件的兼容性问题** - 移除AiocqhttpMessageEvent类型断言,使用安全检查和异常处理机制,解决其他插件构造输入时的报错问题 [#57](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/57) diff --git a/changelogs/v2.1.5.md b/changelogs/v2.1.5.md new file mode 100644 index 0000000..a12d3fd --- /dev/null +++ b/changelogs/v2.1.5.md @@ -0,0 +1,2 @@ +- ✨ **新增临时禁言功能** - 添加闭嘴/说话指令,支持临时禁用自动回复功能,默认5分钟,可自定义时长 [#63](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/63) +- 🔒 **添加权限控制** - 对管理指令添加了管理员权限限制 diff --git a/changelogs/v2.1.6.md b/changelogs/v2.1.6.md new file mode 100644 index 0000000..674dd00 --- /dev/null +++ b/changelogs/v2.1.6.md @@ -0,0 +1,2 @@ +- 🐛 **修复空消息异常** - 修复napcat发送私聊"正在输入"状态时,导致插件异常的问题 [#70](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/70) +- 🐛 **修复代码问题并改进错误处理** - 修复装饰器参数位置错误、历史记录加载失败崩溃问题,改进路径处理和日志记录 diff --git a/changelogs/v2.1.7.md b/changelogs/v2.1.7.md new file mode 100644 index 0000000..f991b85 --- /dev/null +++ b/changelogs/v2.1.7.md @@ -0,0 +1,5 @@ +- 🐛 **修复AstrBot兼容性问题** - 移除对不存在的 `Anonymous` 等消息组件类的依赖,使用类型字符串检查替代类实例检查,兼容 AstrBot 新版本 +- ⚡ **优化私聊回复机制** - 将私聊回复概率固定为1,确保历史消息格式统一 +- ⚡ **优化引用消息显示** - 改进 Reply 组件处理,提供更完整的发送者信息和内容 +- ⚡ **优化@消息处理** - 重构 'at' 和 'atall' 组件处理逻辑,提高代码清晰度和功能性 +- [#72](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/72) [#73](https://github.com/23q3/astrbot_plugin_SpectreCore/pull/73) @Hola-Gracias From 22db2799a9b4b8169897b90e8d185cc15ed78953 Mon Sep 17 00:00:00 2001 From: 23q3 <2335125256@qq.com> Date: Fri, 2 Jan 2026 00:29:18 +0800 Subject: [PATCH 2/8] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E5=8F=91=E5=B8=83=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - prepare-release: 检测 changelog 变更,自动更新版本号并创建 PR - auto-tag: PR 合并后自动创建 Tag 和 GitHub Release --- .github/workflows/auto-tag.yml | 110 ++++++++++++ .github/workflows/prepare-release.yml | 235 ++++++++++++++++++++++++++ 2 files changed, 345 insertions(+) create mode 100644 .github/workflows/auto-tag.yml create mode 100644 .github/workflows/prepare-release.yml diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml new file mode 100644 index 0000000..cba2f1b --- /dev/null +++ b/.github/workflows/auto-tag.yml @@ -0,0 +1,110 @@ +name: Auto Tag and Release on Merge + +on: + pull_request: + types: + - closed + branches: + - main + +jobs: + create-tag-and-release: + # 只在 PR 被合并且带有 release 标签时执行 + if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.merge_commit_sha }} + + - name: Extract version from metadata.yaml + id: version + run: | + # 从 metadata.yaml 读取版本号,移除注释和空白 + VERSION=$(grep '^version:' metadata.yaml | sed 's/version: *//' | sed 's/ *#.*//' | tr -d ' ') + + if [ -z "$VERSION" ]; then + echo "Could not extract version from metadata.yaml" + exit 1 + fi + + # 确保版本号以 v 开头 + if [[ "$VERSION" != v* ]]; then + VERSION="v$VERSION" + fi + + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "Extracted version: $VERSION" + + - name: Check if tag already exists + id: check_tag + run: | + VERSION="${{ steps.version.outputs.version }}" + git fetch --tags + + if git tag -l "$VERSION" | grep -q .; then + echo "Tag $VERSION already exists, skipping" + echo "exists=true" >> "$GITHUB_OUTPUT" + else + echo "Tag $VERSION does not exist, will create" + echo "exists=false" >> "$GITHUB_OUTPUT" + fi + + - name: Create and push tag + if: steps.check_tag.outputs.exists == 'false' + run: | + VERSION="${{ steps.version.outputs.version }}" + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git tag -a "$VERSION" -m "Release $VERSION" + git push origin "$VERSION" + + echo "Created and pushed tag $VERSION" + + - name: Get changelog content + if: steps.check_tag.outputs.exists == 'false' + id: changelog + run: | + VERSION="${{ steps.version.outputs.version }}" + CHANGELOG_FILE="changelogs/${VERSION}.md" + + if [ -f "$CHANGELOG_FILE" ]; then + echo "Found changelog file: $CHANGELOG_FILE" + echo "changelog_file=$CHANGELOG_FILE" >> "$GITHUB_OUTPUT" + else + echo "Changelog file not found: $CHANGELOG_FILE" + echo "Auto-generated release for $VERSION" > /tmp/release_body.md + echo "changelog_file=/tmp/release_body.md" >> "$GITHUB_OUTPUT" + fi + + - name: Determine if prerelease + if: steps.check_tag.outputs.exists == 'false' + id: prerelease + run: | + VERSION="${{ steps.version.outputs.version }}" + + if [[ "$VERSION" == *-* ]]; then + echo "is_prerelease=true" >> "$GITHUB_OUTPUT" + echo "Version $VERSION is a prerelease" + else + echo "is_prerelease=false" >> "$GITHUB_OUTPUT" + echo "Version $VERSION is a stable release" + fi + + - name: Create GitHub Release + if: steps.check_tag.outputs.exists == 'false' + uses: ncipollo/release-action@v1 + with: + tag: ${{ steps.version.outputs.version }} + name: ${{ steps.version.outputs.version }} + bodyFile: ${{ steps.changelog.outputs.changelog_file }} + generateReleaseNotes: true + prerelease: ${{ steps.prerelease.outputs.is_prerelease }} + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 0000000..e01953e --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,235 @@ +name: Prepare Release + +on: + push: + branches: + - dev + paths: + - 'changelogs/v*.md' + +concurrency: + group: prepare-release + cancel-in-progress: false + +jobs: + prepare-release: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.sha }} + + - name: Find new changelog file + id: find_changelog + run: | + # 获取本次推送中变更的 changelog 文件 + CHANGELOG_FILE=$(git diff --name-only ${{ github.event.before }}..${{ github.sha }} -- 'changelogs/v*.md' | head -1 || true) + + if [ -z "$CHANGELOG_FILE" ]; then + echo "No changelog file found in push range, checking added files..." + CHANGELOG_FILE=$(git diff --name-only --diff-filter=A ${{ github.event.before }}..${{ github.sha }} | grep '^changelogs/v.*\.md$' | head -1 || true) + fi + + if [ -z "$CHANGELOG_FILE" ]; then + echo "No new changelog file found in commit" + exit 1 + fi + + if [ ! -f "$CHANGELOG_FILE" ]; then + echo "Changelog file does not exist: $CHANGELOG_FILE" + exit 1 + fi + + echo "changelog_file=$CHANGELOG_FILE" >> "$GITHUB_OUTPUT" + echo "Found changelog file: $CHANGELOG_FILE" + + - name: Extract version from filename + id: version + run: | + CHANGELOG_FILE="${{ steps.find_changelog.outputs.changelog_file }}" + + # 从文件名提取版本号 (changelogs/v2.1.8.md -> v2.1.8) + VERSION=$(basename "$CHANGELOG_FILE" .md) + VERSION_NO_V="${VERSION#v}" + + # 验证版本格式 + if ! [[ "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then + echo "Invalid version format: $VERSION" + echo "Expected format: vX.X.X or vX.X.X-suffix" + exit 1 + fi + + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + echo "version_no_v=$VERSION_NO_V" >> "$GITHUB_OUTPUT" + echo "Detected version: $VERSION" + + - name: Check if tag already exists + run: | + VERSION="${{ steps.version.outputs.version }}" + git fetch --tags + if git tag -l "$VERSION" | grep -q .; then + echo "Error: Tag $VERSION already exists!" + exit 1 + fi + echo "Tag $VERSION does not exist, proceeding..." + + - name: Get current date + id: date + run: echo "date=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT" + + - name: Read changelog content + id: changelog + run: | + CHANGELOG_FILE="${{ steps.find_changelog.outputs.changelog_file }}" + + # 读取 changelog 内容并保存到临时文件 + cat "$CHANGELOG_FILE" > /tmp/changelog_content.txt + + # 存储到 output (使用 delimiter 处理多行) + { + echo 'content<> "$GITHUB_OUTPUT" + + - name: Update metadata.yaml + run: | + VERSION="${{ steps.version.outputs.version }}" + # 替换版本号,保留可能的注释 + sed -i "s/^version: *v[^ #]*/version: $VERSION/" metadata.yaml + + # 验证更新成功 + if ! grep -q "^version: $VERSION" metadata.yaml; then + echo "Failed to update metadata.yaml" + exit 1 + fi + echo "Updated metadata.yaml to version $VERSION" + + - name: Update main.py + run: | + VERSION_NO_V="${{ steps.version.outputs.version_no_v }}" + # 更新 @register 装饰器中的版本号(支持预发布版本) + sed -i "s/\"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-zA-Z0-9.]*\)\{0,1\}\",/\"$VERSION_NO_V\",/" main.py + + # 验证更新成功 + if ! grep -q "\"$VERSION_NO_V\"," main.py; then + echo "Failed to update main.py" + exit 1 + fi + echo "Updated main.py to version $VERSION_NO_V" + + - name: Update README.md badge + run: | + VERSION="${{ steps.version.outputs.version }}" + # 支持预发布版本 + sed -i "s/version-v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-zA-Z0-9.]*\)\{0,1\}/version-$VERSION/" README.md + + # 验证更新成功 + if ! grep -q "version-$VERSION" README.md; then + echo "Failed to update README.md badge" + exit 1 + fi + echo "Updated README.md badge to $VERSION" + + - name: Update README.md latest version section + run: | + VERSION="${{ steps.version.outputs.version }}" + DATE="${{ steps.date.outputs.date }}" + + # 创建新的"最新版本"section内容(不带前导空格) + { + echo "## 📋 最新版本" + echo "" + echo "### $VERSION ($DATE)" + echo "" + cat /tmp/changelog_content.txt + echo "" + } > /tmp/new_section.txt + + # 使用 awk 替换 README 中的"最新版本"section + awk ' + BEGIN { skip = 0 } + /^## 📋 最新版本/ { + skip = 1 + while ((getline line < "/tmp/new_section.txt") > 0) print line + close("/tmp/new_section.txt") + next + } + /^## / && skip { skip = 0 } + !skip { print } + ' README.md > README.md.tmp && mv README.md.tmp README.md + + echo "Updated README.md latest version section" + + - name: Commit changes + run: | + VERSION="${{ steps.version.outputs.version }}" + + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + git add metadata.yaml main.py README.md + + # 检查是否有变更 + if git diff --staged --quiet; then + echo "No changes to commit" + exit 0 + fi + + git commit -m "chore: bump version to $VERSION" + git push origin HEAD:dev + + echo "Committed and pushed changes" + + - name: Create Pull Request + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + VERSION="${{ steps.version.outputs.version }}" + + # 创建 PR body + { + echo "## Release $VERSION" + echo "" + echo "This PR was automatically created by the release workflow." + echo "" + echo "### Changes" + cat /tmp/changelog_content.txt + echo "" + echo "### Files Updated" + echo "- \`metadata.yaml\` - version updated" + echo "- \`main.py\` - version in @register decorator updated" + echo "- \`README.md\` - badge and latest version section updated" + echo "" + echo "---" + echo "*After merging, a tag will be automatically created and a GitHub Release will be published.*" + } > /tmp/pr_body.md + + # 检查是否已存在 dev -> main 的 PR + EXISTING_PR=$(gh pr list --base main --head dev --state open --json number --jq '.[0].number // empty') + + if [ -n "$EXISTING_PR" ]; then + echo "PR #$EXISTING_PR already exists for dev -> main, updating..." + gh pr edit "$EXISTING_PR" \ + --title "Release $VERSION" \ + --body-file /tmp/pr_body.md \ + --add-label "release" + echo "Updated PR #$EXISTING_PR" + exit 0 + fi + + # 创建 PR + gh pr create \ + --base main \ + --head dev \ + --title "Release $VERSION" \ + --body-file /tmp/pr_body.md \ + --label "release" + + echo "Created PR for Release $VERSION" From 32c85a16debfbcf82f9215a644ac6dbf9a6bf52f Mon Sep 17 00:00:00 2001 From: 23q3 <2335125256@qq.com> Date: Fri, 2 Jan 2026 00:36:50 +0800 Subject: [PATCH 3/8] chore: add v2.1.8 changelog --- changelogs/v2.1.8.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelogs/v2.1.8.md diff --git a/changelogs/v2.1.8.md b/changelogs/v2.1.8.md new file mode 100644 index 0000000..42a0a60 --- /dev/null +++ b/changelogs/v2.1.8.md @@ -0,0 +1 @@ +- 🧪 **测试自动化流程** - 验证 workflow 正常工作 From 5a41074efe823a16fa8c08635bfac233de18c39b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 1 Jan 2026 16:36:59 +0000 Subject: [PATCH 4/8] chore: bump version to v2.1.8 --- README.md | 10 +++------- main.py | 2 +- metadata.yaml | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 9aa59d5..0f638b1 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ ![SpectreCore](https://avatars.githubusercontent.com/u/129108081?s=48&v=4) -[![version](https://img.shields.io/badge/version-v2.1.7-blue.svg?style=flat-square)](https://github.com/23q3/astrbot_plugin_SpectreCore) +[![version](https://img.shields.io/badge/version-v2.1.8?style=flat-square)](https://github.com/23q3/astrbot_plugin_SpectreCore) [![license](https://img.shields.io/badge/license-AGPL--3.0-green.svg?style=flat-square)](LICENSE) [![author](https://img.shields.io/badge/author-23q3-orange.svg?style=flat-square)](https://github.com/23q3) @@ -70,13 +70,9 @@ SpectreCore (影芯) 是一个为 AstrBot 设计的高级群聊互动插件, ## 📋 最新版本 -### v2.1.7 (2025-11-17) +### v2.1.8 (2026-01-01) -- 🐛 **修复AstrBot兼容性问题** - 移除对不存在的 `Anonymous` 等消息组件类的依赖,使用类型字符串检查替代类实例检查,兼容 AstrBot 新版本 -- ⚡ **优化私聊回复机制** - 将私聊回复概率固定为1,确保历史消息格式统一 -- ⚡ **优化引用消息显示** - 改进 Reply 组件处理,提供更完整的发送者信息和内容 -- ⚡ **优化@消息处理** - 重构 'at' 和 'atall' 组件处理逻辑,提高代码清晰度和功能性 -- [#72](https://github.com/23q3/astrbot_plugin_SpectreCore/issues/72) [#73](https://github.com/23q3/astrbot_plugin_SpectreCore/pull/73) @Hola-Gracias +- 🧪 **测试自动化流程** - 验证 workflow 正常工作 ## ⚠️ 注意事项 diff --git a/main.py b/main.py index 16e92c2..12c89d1 100644 --- a/main.py +++ b/main.py @@ -7,7 +7,7 @@ "spectrecore", "23q3", "使大模型更好的主动回复群聊中的消息,带来生动和沉浸的群聊对话体验", - "2.1.7", + "2.1.8", "https://github.com/23q3/astrbot_plugin_SpectreCore" ) class SpectreCore(Star): diff --git a/metadata.yaml b/metadata.yaml index 1e6fd94..ef80905 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -1,7 +1,7 @@ name: spectrecore # 这是你的插件的唯一识别名。 desc: 使大模型更好的主动回复群聊中的消息,带来生动和沉浸的群聊对话体验 # 插件简短描述 help: 自动检测群聊消息并让AI模型进行回复,让群聊更加生动有趣。 # 插件的帮助信息 -version: v2.1.7 # 插件版本号。格式:v1.1.1 或者 v1.1 +version: v2.1.8 # 插件版本号。格式:v1.1.1 或者 v1.1 author: 23q3 # 作者 repo: https://github.com/23q3/astrbot_plugin_SpectreCore # 插件的仓库地址 display_name: 🌟 SpectreCore From a1df27f96413c2305522c7eb351f5d45028dc68e Mon Sep 17 00:00:00 2001 From: 23q3 <2335125256@qq.com> Date: Fri, 2 Jan 2026 00:54:44 +0800 Subject: [PATCH 5/8] chore: trigger release workflow --- changelogs/v2.1.8.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelogs/v2.1.8.md b/changelogs/v2.1.8.md index 42a0a60..17fd28f 100644 --- a/changelogs/v2.1.8.md +++ b/changelogs/v2.1.8.md @@ -1 +1,2 @@ - 🧪 **测试自动化流程** - 验证 workflow 正常工作 + From bccecfca75447955a07fcbc640e7f87fa8e6aac6 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 1 Jan 2026 16:55:20 +0000 Subject: [PATCH 6/8] chore: bump version to v2.1.8 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0f638b1..d26e65c 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ SpectreCore (影芯) 是一个为 AstrBot 设计的高级群聊互动插件, - 🧪 **测试自动化流程** - 验证 workflow 正常工作 + ## ⚠️ 注意事项 - 本插件和 AstrBot 自带的主动回复功能之间没有任何联系,在使用本插件时请关闭 AstrBot 的主动回复功能,以免重复回复 From c074ebb67ae079bf0bd83e9ff9817efe84802b3e Mon Sep 17 00:00:00 2001 From: 23q3 <2335125256@qq.com> Date: Fri, 2 Jan 2026 01:04:06 +0800 Subject: [PATCH 7/8] chore: trigger workflow --- changelogs/v2.1.8.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelogs/v2.1.8.md b/changelogs/v2.1.8.md index 17fd28f..6c783a4 100644 --- a/changelogs/v2.1.8.md +++ b/changelogs/v2.1.8.md @@ -1,2 +1,3 @@ - 🧪 **测试自动化流程** - 验证 workflow 正常工作 + From 9f606c95ea3ba8a53a751210d44aff3b5dee0ded Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 1 Jan 2026 17:04:44 +0000 Subject: [PATCH 8/8] chore: bump version to v2.1.8 --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d26e65c..0721f44 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ SpectreCore (影芯) 是一个为 AstrBot 设计的高级群聊互动插件, - 🧪 **测试自动化流程** - 验证 workflow 正常工作 + ## ⚠️ 注意事项 - 本插件和 AstrBot 自带的主动回复功能之间没有任何联系,在使用本插件时请关闭 AstrBot 的主动回复功能,以免重复回复