Repository navigation
Tell the editor which fields take AI actions - #3129
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #3101
An editor with
ai.usecan now learn where to offer AI actions without theaisettings area.GET /api/management/v1/ai/fieldsneedsai.usein the site and answers{ "enabled", "locale", "fields" }: whether the site names a provider, the locale of the request, and per content type the opted-in fields the caller may act on there. It runs the same opt-in and update checks asPOST /ai/actions/{action}, which now share two small helpers so the two cannot drift. The body is declared asAiFieldsin the OpenAPI document. Spec 5.5 and the plugin's README describe the route.Dependencies
None.
Decisions
GET /ai/fields, beside/ai/actions/{action}and/ai/usage.provideris a provider the plugin has: notnone, and not a removed one (anthropic,ollama). The factory is not asked, so whether the provider is configured well enough to answer (FCMS1684,FCMS1685), or whether a host's factory gives no client (FCMS1682), shows only at the call. A site that is off lists no field.UpdateandUpdatableFieldsofIEffectiveAccess) in the locale of the request. A type the caller cannot read is left out even if it may update it. A type with no such field is left out. Fields the caller may only set on create are left out, because the actions refuse them too (FCMS3103).?locale=orX-Cms-Locale), echoed back inlocale. A grant limited to other locales lists nothing.fieldsis a map of type to field names in schema order, like thefieldssetting. No provider, model, endpoint or key, and nothing about whether a key is set.Tests
AiFieldsTestsintests/FluentCMS.Plugins.AiAssist.Testscovers each acceptance item:ai.usegets the opted-in fields it may update and not those it may only read, and the actions agree;none, a bare site and a removed provider are off;ai.usegets 403;AiFieldsbody.AiSiteTestschecks that the route answers 404 where the plugin is disabled. The full AI assist suite passes (133).dotnet build -c Release -warnaserror, the SDK, Core and Architecture tests and markdownlint pass.