filagora / filagora-ai-forums
Thread vectors and AI thread assist for filagora-forums: the chat can find earlier threads, and staff can ask for a suggested answer to one.
Requires
- php: ^8.4
- filagora/filagora-ai: ^0.1.2
- filagora/filagora-core: ^0.2.2
- filagora/filagora-forums: ^0.6
- filagora/filagora-search: ^0.2.2
Requires (Dev)
- filagora/filagora-entitlements: ^0.2.1
- larastan/larastan: ^3.0
- laravel/pint: ^1.0
- orchestra/testbench: ^11.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
Suggests
- filagora/filagora-entitlements: Answers the access check from entitlement grants. Without it, bind Filagora\Core\Contracts\AccessChecker.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-11-15 12:52:00 UTC
README
An optional add-on for filagora-forums and
filagora-ai. Install it and the AI chat can find earlier
forum threads, and staff can ask for a suggested answer to a thread. Without it, nothing about the AI
touches the forum.
Status: early. The API may still change before 1.0.
What it provides
Overview
Thread vectors and AI thread assist for filagora-forums: the chat can find earlier threads, and staff can ask for a suggested answer to one.
Tables
This package adds no tables of its own.
Commands
| Command | What it does |
|---|---|
thread-vectors:backfill |
Embed answered threads into the thread_vectors index. Repeating it is safe (it overwrites); do not run two at once. |
thread-vectors:status |
Show where the thread_vectors index stands and what to run next. Read-only. |
Events
This package fires no events.
Access
| Ability | Entitlement key |
|---|---|
filagora.ai.thread-assist |
operator.ai.thread_assist |
Using it
- Thread vectors. One vector per answered thread, from its title and first post, in a vector-only
search index of its own (
thread_vectors), kept apart from the keyword index of the same threads. A thread is worth a vector when it is approved, in an active forum, and answered. The vector is kept current as threads and their opening posts change, but not on every reply: only the changes that alter whether a thread has a vector or what it says. - A place for the chat to look. A retrieval source (priority 300) offers the threads closest in meaning to a question, each as the question plus the replies most likely to hold the answer (the first reply from someone other than the asker, the two longest, and the last). What the person asking could not open is left out, per person.
- Thread assist.
ThreadAssistGate,ThreadAssistServiceandThreadAssistPlanbuild a bounded view of a thread (the opening post and the newest replies, never a deleted or unapproved post, fenced off as data), ground it in whatever the registered retrieval sources hold, and stream the answer. Answers are kept per person and replayed free while the thread is unchanged. Routes, views and throttles belong to the host. - Commands.
thread-vectors:backfill(careful, resumable, built onfilagora-ai'sVectorBackfill: it checks the provider and the engine before spending anything and stops at the first failure) andthread-vectors:status.
Requirements
PHP 8.4. Tested against MariaDB 11.4. Requires filagora/filagora-ai, filagora/filagora-core, filagora/filagora-forums and filagora/filagora-search.
Install
composer require filagora/filagora-ai-forums php artisan vendor:publish --tag=filagora-ai-forums-config
Then, once embeddings are on (filagora-ai):
php artisan filagora:search:sync-settings --index=thread_vectors
php artisan thread-vectors:status
php artisan thread-vectors:backfill --limit=500 # a small trial; prints tokens and cost
php artisan thread-vectors:backfill
Set AI_THREAD_VECTORS_ENABLED=true and restart the queue workers. Until then threads are not indexed
as they change and the chat does not search them.
Configuration
config/filagora-ai-forums.php is merged with the host's copy, one level deep: a key you set replaces
that key's whole array.
gates: the abilityfilagora.ai.thread-assistmaps to the entitlementoperator.ai.thread_assist. Point it at your own key; granting it to members opens thread assist to them (they must also be able to open the thread).thread_vectors:enabled(AI_THREAD_VECTORS_ENABLED),first_post_limit.assist:system_prompt,source_limits,cache_seconds,thread_route.
Extending
Extend through documented contracts, events and registries. Anything not documented is @internal.
Testing
composer test
Tests run against a real MariaDB, never SQLite, so engine behaviour (FULLTEXT,
ONLY_FULL_GROUP_BY, collation) matches production. Host and credentials come from
your environment; the database is always named testing, never your development one.
Local development (DDEV)
.ddev/ is included. ddev start creates both db and testing (run ddev restart once
if testing is missing), then ddev exec vendor/bin/pest.
Licence
MIT. See LICENSE.