mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-18 18:10:45 +08:00
This commit introduces `DiscourseAi.register_feature` as the public API for other plugins to register AI-powered features. Previously, plugins had to manually register with `DiscoursePluginRegistry`, define their own agent site setting in `settings.yml`, create their own `EnumSiteSetting` subclass for the agent enum, register the site setting area, and assign settings to that area. This was a lot of boilerplate that every plugin would need to duplicate. This commit consolidates all of that into a single `DiscourseAi.register_feature` call that handles: 1. Auto-defining the `<module>_<feature>_agent` site setting with the correct enum, `depends_on`, and `depends_behavior` configuration 2. Registering the `ai-features/<module_name>` site setting area so the admin edit page can load the settings 3. Assigning both the generated agent setting and the `enabled_by_setting` to that area 4. Registering the feature in the `DiscoursePluginRegistry` external AI features registry The data-explorer plugin is updated to use the new API, which lets it drop its custom `AiAgentEnumerator` class, the manual `data_explorer_query_generation_agent` setting definition in `settings.yml`, and the manual area registration and assignment code. |
||
|---|---|---|
| .. | ||
| admin/assets/javascripts/admin | ||
| app | ||
| assets | ||
| config | ||
| db/migrate | ||
| lib | ||
| spec | ||
| test/javascripts | ||
| package.json | ||
| plugin.rb | ||
| README.md | ||
| tsconfig.json | ||
Data Explorer Plugin
This plugin allows admins to run SQL queries against the live Discourse database, including parameterized queries and formatting for several common column types.
For more information, please see: https://meta.discourse.org/t/data-explorer-plugin/32566