mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-06 07:26:04 +08:00
Right now, AI modules and features are hardcoded in
`Configuration::Feature` and `Configuration::Module`. If another plugin
wants to register an AI-powered feature (with its own agent, LLM config,
and a spot on the AI features admin page), there's no way to do it
without modifying discourse-ai directly.
Data explorer needs a query generation agent, and other plugins will be
able to add their own agents too. So we need a proper extensible API
here.
The consumer code ends up looking like this:
```
DiscoursePluginRegistry.register_external_ai_feature(
{
module_name: :data_explorer,
feature: :query_generation,
agent_klass: DiscourseDataExplorer::AiQueryGenerator,
enabled_by_setting: "data_explorer_ai_queries_enabled",
},
self,
)
```
<img width="658" height="258" alt="Screenshot 2026-03-26 at 2 25 19 PM"
src="https://github.com/user-attachments/assets/9239b903-78a5-4e8b-9bf0-e385a030920b"
/>
---------
Co-authored-by: Roman Rizzi <rizziromanalejandro@gmail.com>
|
||
|---|---|---|
| .. | ||
| embedding_defs_validator_spec.rb | ||
| feature_register_spec.rb | ||
| feature_spec.rb | ||
| llm_enumerator_spec.rb | ||
| llm_validator_spec.rb | ||
| module_register_spec.rb | ||
| spam_detection_validator_spec.rb | ||