PHPackages                             nopj/ai - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. nopj/ai

ActiveFlarum-extension[Queues &amp; Workers](/categories/queues)

nopj/ai
=======

AI assistant integration for Flarum with multi-turn conversation support.

v0.1.1(1mo ago)218↓100%MITPHP

Since Apr 14Pushed 1mo agoCompare

[ Source](https://github.com/chao2hang/nopj-ai)[ Packagist](https://packagist.org/packages/nopj/ai)[ Docs](https://github.com/chao2hang/nopj-ai)[ RSS](/packages/nopj-ai/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

Nopj AI
=======

[](#nopj-ai)

Flarum 的 AI 助手集成扩展，支持多轮对话、异步回复和原生回复式提及。

[![Packagist Version](https://camo.githubusercontent.com/23abc1b16c8a94ba7421aca770d276e945fa0f90537a516686578edc4575600e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e6f706a2f61693f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nopj/ai)[![Packagist Downloads](https://camo.githubusercontent.com/724e521b9fcf43ea07f85aacbd27c3b783077d4e1617cfd00a8548a9adba7db3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e6f706a2f61693f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nopj/ai)[![GitHub Stars](https://camo.githubusercontent.com/4aca7dc91e665e78bfcee1b4321f69bca36b6d9b80bb9b7d6cb886ab2a95b8e5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6368616f3268616e672f6e6f706a2d61693f7374796c653d666c61742d737175617265)](https://github.com/chao2hang/nopj-ai/stargazers)[![License](https://camo.githubusercontent.com/92f1f8e25de73f4ab3952ecc85555a19f8f1db211103a3d8b20026db31c34876/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6368616f3268616e672f6e6f706a2d61693f7374796c653d666c61742d737175617265)](https://github.com/chao2hang/nopj-ai/blob/main/LICENSE)

功能特性
----

[](#功能特性)

- 异步 AI 回复，不会阻塞用户正常发帖
- 使用 Flarum 原生 `@"显示名称"#p帖子ID` 格式渲染回复式提及
- 通过持久化的 AI 会话和消息实现多轮讨论记忆
- 可配置 API 端点、模型、系统提示、上下文深度和温度
- 与 Flarum `flarum/mentions` 扩展完美兼容

环境要求
----

[](#环境要求)

- Flarum `^1.8`
- PHP 8.x
- `flarum/mentions`
- 兼容的 Chat Completions API 端点

安装
--

[](#安装)

使用 Composer 安装：

```
composer require nopj/ai
```

然后在 Flarum 管理面板中启用该扩展。

配置
--

[](#配置)

在管理面板中配置以下选项：

- AI 用户
- API 端点
- API 密钥
- 模型
- 系统提示
- 最大令牌数
- 温度
- 上下文帖子数量
- 流式模式

工作原理
----

[](#工作原理)

1. 用户回复 AI 用户，或回复由 AI 用户发布的帖子。
2. 插件立即创建一个“正在输入”的占位帖子。
3. 实际的 AI 请求异步运行。
4. 占位帖子在完成后更新为最终的 AI 回复。

这样可以保持正常发帖的响应性，同时保留原生的 Flarum 提及渲染和通知机制。

注意事项
----

[](#注意事项)

- 最佳生产环境表现需要搭配真实的异步队列 worker 使用。
- 如果论坛仍在使用 Flarum 的同步队列，扩展会自动回退到响应后后台执行。
- 该扩展目前主要针对回复式帖子提及，而非传统的 `@user` 提及通知。

开发
--

[](#开发)

从扩展目录构建前端资源：

```
cd js
npm install
npm run build
```

链接
--

[](#链接)

- 源码：
- 问题反馈：
- Packagist：

许可证
---

[](#许可证)

MIT

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance92

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

56d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c67e2c684c4576cbf4e68917c8f5b0c56cbea1604d90a50a73b1aac286a29f74?d=identicon)[chao2hang](/maintainers/chao2hang)

---

Top Contributors

[![chao2hang](https://avatars.githubusercontent.com/u/84966417?v=4)](https://github.com/chao2hang "chao2hang (4 commits)")

---

Tags

asyncaimentionsflarumllmflarum-extensionassistant

### Embed Badge

![Health badge](/badges/nopj-ai/health.svg)

```
[![Health](https://phpackages.com/badges/nopj-ai/health.svg)](https://phpackages.com/packages/nopj-ai)
```

###  Alternatives

[flarum-lang/russian

Russian language pack for Flarum.

12127.5k](/packages/flarum-lang-russian)[flarum-lang/french

French language pack to localize the Flarum forum software plus its official and third-party extensions.

1936.5k](/packages/flarum-lang-french)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
