Review options
All AI Toolkit methods that edit the document have a reviewOptions property. When configured, it allows you to display a review UI after the document is edited.
const result = toolkit.executeTool({
toolName: 'tiptapEdit',
input,
// Display a UI that allows the user to review
// the changes after they are applied.
reviewOptions: { mode: 'review' },
})After editing the document, a list of suggestions will be displayed.
The reviewOptions property takes a ReviewOptions configuration object.
ReviewOptions
mode?('disabled' | 'review' | 'preview'): Whether to review the changes before or after applying them. Default:'disabled''disabled': No review UI is displayed.'review': The changes are applied first, then a review UI is displayed allowing the user to undo them.'preview': A preview UI is displayed before applying the changes, allowing the user to accept or reject them.
displayOptions?(DisplayOptions): Customize how suggestions are displayedshowReplacement?(boolean): Whether to show replacement content as a diff. Default:truehideCurrentContent?(boolean): Hide the current content in the diff widget. Default:falseshowSubChanges?(boolean): Show sub-changes when an inline group is displayed. Default:trueattributes?(Record<string, any>): Extra HTML attributes to be added to the suggestionreplacementAttributes?(Record<string, any>): Extra HTML attributes for the replacement decorationsubChangeAttributes?(Record<string, any>): Extra HTML attributes for inline sub-change highlightsreplacementSubChangeAttributes?(Record<string, any>): Extra HTML attributes for sub-change highlights inside replacement contentrenderDecorations?(RenderDecorations): A function to render the suggestion as ProseMirror decorations
metadata?(Record<string, any>): Extra metadata for the suggestions that can be used to store additional information about them (e.g. their source or their category). It is not used internally by the extension but it may help developers customize how the suggestions are displayed in the UI.useDiffUtility?(boolean): Whether to use the Diff Utility to compare the documents before and after the change, displaying the deleted and added content as a rich diff. Iffalse, the deleted content and added content are displayed in a whole block, as a single change. Default:truediffUtilityOptions?(ExternalDiffUtilityOptions): Options for comparing the documents with the diff utility. See available options.