npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

koishi-plugin-ai-manager

v1.2.7

Published

基于大模型的全自动群组消息审查。汇总消息并进行分析,并根据预设规则,自动对违规消息执行撤回、转发操作,或对违规用户进行禁言或踢出。

Readme

koishi-plugin-ai-manager

npm

基于大模型的全自动群组消息审查。汇总消息并进行分析,并根据预设规则,自动对违规消息执行撤回、转发操作,或对违规用户进行禁言或踢出。


✨ 功能特性

  • 🚀 灵活的审查模式:支持即时模式maxBatchTime 设为 0,每条消息独立分析)、智能批处理模式(按数量或时间打包)和普通批处理模式(仅按数量打包),可在成本与响应速度间自由权衡。
  • 📊 深度上下文理解:插件直接向 AI 发送消息的完整元素结构 (h-element),而非简单文本。这使得 AI 能够理解图片、引用、At 等复杂消息,实现更精准的上下文分析和判断。
  • 🔌 通用 API 支持:支持对接所有兼容 OpenAI chat/completions API 格式的语言模型服务。
  • 📝 高度自定义规则:通过自定义 Rule (规则),您可以精确地告诉 AI 需要审查哪些内容,无论是广告、不当言论还是其他违规行为。
  • ⚙️ 灵活的自动化操作:可自由组合撤回消息禁言用户(支持自定义时长)、踢出用户转发违规证据到指定频道等多种操作。
  • 🛠️ 丰富的配置选项:支持配置白名单用户、批处理大小、批处理最大等待时间等参数,满足不同场景下的精细化管理需求。
  • 🐛 内置调试模式:一键开启 Debug 模式,轻松查看发送给 AI 的原始请求和收到的原始响应,极大地方便了规则调试和问题排查。

⚙️ 配置项说明

1. 模型配置

此部分用于配置您所使用的大语言模型服务。

| 配置项 | 类型 | 默认值 | 说明 | | :--- | :--- | :--- | :--- | | Endpoint | string | - | 必需。您的 AI 服务端点,必须兼容 OpenAI 的 /v1/chat/completions 格式。例如 https://api.openai.com/v1。 | | ApiKey | string | - | 必需。您的 AI 服务密钥 (API Key)。 | | Model | string | - | 您希望使用的模型名称,例如 gpt-4oglm-4 等。 | | Rule | text | - | 核心功能。您为 AI 制定的审查规则,请用自然语言清晰描述,AI 将严格按照此规则进行判断。提示:由于 AI 能接收到消息的完整结构,您可制定更复杂的规则,例如“禁止发送包含二维码的图片”。 | | Debug | boolean | false | 启用调试模式。开启后,将在控制台以 info 等级输出发送给 AI 的完整请求体和收到的原始响应体。 |

2. 审查操作

此部分用于配置检测到违规行为后需要执行的操作。

| 配置项 | 类型 | 默认值 | 说明 | | :--- | :--- | :--- | :--- | | Action | checkbox | [] (无) | 选择要执行的操作,可多选:recall (撤回),mute (禁言),kick (踢出),forward (转发)。 | | Target | string | onebot:123456789 | 如果选择了 forward,违规消息将会被作为合并转发消息发送到这个目标。格式为 平台名:频道/群组ID。 | | forwardRaw | boolean | false | 开启后,在转发违规证据时,会额外附加一条消息,内容为 AI 进行分析所依据的原始消息结构(h-element 数组)的文本表示。这对于调试 Rule 和理解 AI 的判断依据至关重要。 |

3. 消息配置

此部分用于配置消息的审查与批处理行为。

| 配置项 | 类型 | 默认值 | 说明 | | :--- | :--- | :--- | :--- | | batchMode | boolean | false | 是否启用智能批处理。关闭时为普通批处理模式,仅当消息数量达到 maxBatchSize 时触发分析。开启时为智能批处理模式,当消息数量达到 maxBatchSize 或等待时间超过 maxBatchTime 时均会触发分析。 | | maxBatchSize | number | 128 | 一个批次中最多包含的消息数量。达到此数量将立即触发一次 AI 分析。 | | maxBatchTime | number | 300 | (单位: 秒) 一个批次最长的等待时间。将此项设为 0 可强制开启即时模式,即每条消息都立即触发分析。 | | whitelist | string[]| ['2854196310'] | 白名单用户ID列表。这些用户的消息将被插件完全忽略,不进行审查。 |