You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow packages to format their property values for the AI content tools #809
The content tools (get_umbraco_content and others built on ContentToolHelpers) pass every property through PropertyValueFormatter. That class is internal and has rules only for core editors:
rich text and Markdown are stripped to plain text;
media and content pickers are reduced to name and URL;
blocks are recursed;
strings are truncated.
Every other editor's converted value goes to the model unchanged.
For a package editor whose value converter builds a rich model, that has three effects:
Large tool output. Our editor stores a small selection (about 200 bytes of JSON). Its converter turns that into the full content the front end renders, 9–34 KB per property. The model receives all of it on every page read: about 80 KB for one test page with five such properties, while a summary of a few hundred bytes would do.
No access to the stored value. To edit the property, the model needs the stored value, but it only ever sees the converted one. We worked around this with our own tool that reads the stored value.
The culture doesn't reach the converter. The property is read with GetValue(culture), but a converter that picks its output language from IVariationContextAccessor still sees the request's culture. On a culture-variant page the model gets the default language.
Proposal
An extension point that follows the existing IAIPropertyValueHandler pattern:
publicinterfaceIAIPropertyValueFormatter:IDiscoverable{stringForPropertyEditorSchemaAlias{get;}// Return what the model should see for this property; null falls back to the built-in rules.object?Format(IPublishedPropertyproperty,string?culture);}
Registered through builder.AIPropertyValueFormatters() and discovered automatically, with the built-in rules as the fallback. A package could then give the model a compact, culture-aware summary of its value instead of the full model.
Setting the variation context to the requested culture while formatting would also solve point 3 for every converter, independently of this proposal.
Environment: Umbraco 17.6.2, Umbraco.AI 17.8.2 (confirmed against the v17/main source).
Activity