[size=14pt][b]AI Assistant[/b] 1.2.2[/size]
by [url=https://boredskull.net]BoredSkull[/url] - ISC licence

Connect your forum to the AI system of your choice and put it to work for members and moderators.

[b]Choose your AI system[/b]
[list]
[li]OpenAI (ChatGPT), Anthropic (Claude), Google Gemini, GroqCloud, Mistral AI and OpenRouter (hundreds of models with one key)[/li]
[li]Any OpenAI-compatible server - self-hosted Ollama or LM Studio (nothing leaves your server), DeepSeek, Together, vLLM...[/li]
[li]Pick a default, send individual tasks to different AI systems, and optionally let members choose[/li]
[li]"Fetch models" lists the provider's live models; "Test connection" checks your key[/li]
[li]API keys are stored encrypted (AES-256-GCM, keyed from your forum secret)[/li]
[/list]

[b]For members - in the post editor, quick reply and (optionally) PMs[/b]
[list]
[li]Proofread, Improve writing, Shorten, Expand[/li]
[li]Change tone (friendly, formal, casual, professional, enthusiastic, diplomatic)[/li]
[li]Translate into a list of languages you choose[/li]
[li]Suggest topic titles (one click fills the subject)[/li]
[li]Draft a reply from the recent discussion plus your own notes[/li]
[li]Custom instruction ("turn this into a numbered list")[/li]
[li]Results appear in an editable preview - Replace, Insert, Copy or Discard. BBCode is preserved.[/li]
[/list]

[b]Topic summaries[/b]
"Summarise this topic" on longer topics. Summaries are reused only while the bounded, censored source and summary prompt match. Changed source content triggers regeneration; stale summaries are not displayed.

[b]For moderators[/b]
[list]
[li]"AI review" button on posts: verdict (fine / worth a look / likely breaks the rules), categories, confidence and reason, checked against your own community rules[/li]
[li]Optional auto-screening of posts by new members and guests: flagged posts go to the approval queue and moderators are notified. If the AI is down, returns an invalid verdict, or runs out of screening allowance, posts go through as normal. Edits to existing posts are not automatically screened; moderators can review them manually.[/li]
[/list]

[b]Cost and privacy controls[/b]
[list]
[li]Per-member hourly and forum-wide daily limits count successful member tools only; screening has its own attempt cap.[/li]
[li]Maximum input length, response length, timeout and topic context size[/li]
[li]Exclude boards completely; PM support is off by default[/li]
[li]Usage log with tokens per provider, errors and screening results; automatic pruning[/li]
[li]Every prompt is editable in the admin panel[/li]
[/list]

[b]Setup[/b]
[list type=decimal]
[li]Admin > Configuration > AI Assistant > AI Systems: tick a provider, paste its API key, save, then click Test connection.[/li]
[li]Tasks & Prompts: switch tasks on or off and, if you like, give a task its own AI system.[/li]
[li]Permissions: "Use the AI writing assistant", "View and generate AI topic summaries" and "Run AI moderation reviews" are in the AI Assistant group. On first install they are given to Regular Members (write + summaries) and Global Moderators (all three); change them as you wish.[/li]
[/list]

[b]Requirements[/b]
SMF 2.1.x, PHP 7.4+ with the cURL and OpenSSL extensions. Auto-screening needs Post Moderation enabled in Core Features.

[b]Notes[/b]
[list]
[li]Your members' text is sent to the AI provider you choose. Tell your members in your privacy policy, or use a self-hosted model.[/li]
[li]If you change $auth_secret in Settings.php, re-enter your API keys.[/li]
[li]Uninstalling with "Remove all data" deletes the log, cached summaries, settings and permissions.[/li]
[/list]

[b]BoredSkull Ecosystem[/b]
[list]
[li]Optional BoredSkull Ecosystem admin tab. It lists integrations only when compatible companion mods register themselves.[/li]
[li]Hooks-first extension API: integrate_boredskull_aiassistant_capabilities and integrate_boredskull_aiassistant_event.[/li]
[li]Events for completed requests, topic summaries, moderator reviews and held posts; no member text, prompts or credentials are included.[/li]
[li]Companion mods must check visibility, approval and permissions themselves before displaying any event.[/li]
[/list]

[b]Changes in 1.2.2[/b]
[list]
[li]Separate screening allowance: 100 attempts per rolling 24 hours by default (0 switches screening calls off), reserved atomically, with its own 5-10 second timeout (default 8). Failed screening attempts count; failed member tools and admin connection tests do not use member quotas. This is a request count, not a spending cap - provider-side spending limits are still recommended. Clearing the usage log also resets the counters.[/li]
[li]Sturdier verdict parsing: the first complete JSON verdict is used and trailing chatter is ignored. Verdict and confidence are required; categories and reason are optional. Invalid answers are logged as errors and screening fails open.[/li]
[li]Held posts use SMF's own approval queue and notifications. Automatic screening covers new posts, not edits.[/li]
[li]Less hidden "thinking" for GPT-5 mini and Gemini 2.5 Flash; unfinished <think> text from local models is discarded.[/li]
[li]Topic summaries are fingerprinted against the exact (censored) text and prompt sent, checked before serving a saved summary and again after generating. Summaries saved by older versions are deleted on upgrade and regenerated when next requested.[/li]
[li]Editor requests are signed by the forum for the page they came from; topic access and board exclusions are rechecked on every request.[/li]
[li]GroqCloud and Google Gemini (native API) providers, both usable as the default or per task.[/li]
[li]Final-check fixes: PHP 8 errors from providers now fail open instead of breaking posting; malformed request values no longer raise warnings; the "post held" ecosystem event is sent once (was twice for new topics); admin connection tests no longer emit ecosystem events; members can no longer break out of the screening prompt's post delimiters; no hard dependency on the mbstring extension; JSON responses are never mixed with database debug output; usage log gains a Pending filter; dark-theme styling fixed; clipboard copy falls back when the browser refuses.[/li]
[li]Upgrade from 1.2.1 keeps all settings, permissions, API keys, logs and ecosystem hooks. Starter permissions are only added on a fresh install.[/li]
[/list]
