nopj/ai

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

Maintainers

Package info

github.com/chao2hang/nopj-ai

Type:flarum-extension

pkg:composer/nopj/ai

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.1 2026-04-14 09:05 UTC

This package is auto-updated.

Last update: 2026-04-14 09:08:21 UTC


README

Packagist Version Packagist Downloads GitHub Stars License

AI assistant integration for Flarum with multi-turn conversation, async replies, and native reply-style mentions.

Features

  • Async AI replies that do not block normal user posting
  • Reply-style mention rendering using Flarum native @"Display Name"#pPOST_ID format
  • Multi-turn discussion memory via persisted AI sessions and messages
  • Configurable API endpoint, model, system prompt, context depth, and temperature
  • Works with Flarum flarum/mentions

Requirements

  • Flarum ^1.8
  • PHP 8.x
  • flarum/mentions
  • A compatible chat completions API endpoint

Installation

Install with Composer:

composer require nopj/ai

Then enable the extension in the Flarum admin panel.

Configuration

In the admin panel, configure:

  • AI user
  • API endpoint
  • API key
  • Model
  • System prompt
  • Max tokens
  • Temperature
  • Context posts count
  • Streaming mode

How It Works

  1. A user replies to the AI user, or replies to a post authored by the AI user.
  2. The plugin immediately creates a typing placeholder post.
  3. The actual AI request runs asynchronously.
  4. The placeholder post is updated into the final AI response after completion.

This keeps normal posting responsive while preserving native Flarum mention rendering and notifications.

Notes

  • Best production behavior is achieved with a real async queue worker.
  • If the forum is still using Flarum's sync queue, the extension falls back to post-response background execution.
  • The extension currently targets reply-style post mentions rather than @user mention notifications.

Development

Build frontend assets from the extension directory:

cd js
npm install
npm run build

Links

License

MIT