Customize chat, history and language
The default assistant is a compact prompt in the grid header. Choose chat when users benefit from seeing earlier requests and responses. Both presentations use the same configured interpreter, permissions and approval flow.
The snippets extend the quick start; interpret, saved prompts and persistence callbacks are supplied by your application. For an explanation of the user controls, see Use the assistant.
Shared UI, history and translations
Section titled “Shared UI, history and translations”All assistant controls belong to @revolist/ui/ai. The compact prompt grows for multiline text; Enter submits and Shift+Enter inserts a line break. IME composition is respected, and typing in the prompt does not trigger grid editing. Suggestions sit inside the composer, below the message input, with up to three buttons and a More (…) dropdown for additional requests. Clarification choices reuse those controls. AiRequestTrail provides view steps with individual removal and Clear all.
Optional chat presentation
Section titled “Optional chat presentation”grid.aiAssistant = { interpret, ui: { mode: 'chat' },};Chat mode reuses the shared AiChat/AiMessage components to display submitted requests and actual assistant/status responses. The default remains the compact toolbar. The demo enables chat through one shared configuration in all four frameworks. Previews and Apply/Cancel stay in the current assistant response; existing Undo/Redo, Restore and Reset controls remain separate grid operations.
The local transcript retains at most 50 messages and 64 KiB. It displays visible feedback, without exposing hidden model prompts or reasoning. Displaying messages does not send the transcript or action data to a model: conversation, samples and answerFromAction retain their independent disclosure policies. Scripted mode remains scripted.
Use the installed plugin’s clearChat() to clear the displayed transcript and opt-in model conversation, without resetting the grid. Clearing is disabled while busy or awaiting approval. Host-persisted prompt recall remains separately controlled.
Prompt recall is separate from model conversation. Enable it only when wanted:
grid.aiAssistant = { interpret, conversation: { maxMessages: 8, maxBytes: 8192 }, // Sent to interpreter. ui: { promptHistory: { items: savedPrompts, // Oldest first; loaded by your application. onChange: items => savePromptsForCurrentUser(items), }, activityDurationMs: 8000, },};Recall keeps at most 20 prompts and 8 KiB. ArrowUp/Down recalls them only at the first/last line boundary and restores an unsent draft. There is no automatic localStorage persistence or model disclosure. Your persistence callback owns user isolation, retention and deletion. Activity auto-dismiss is optional; completed neutral/success items fade out, while busy/warning/error items remain. The demo places Activity in its bottom-right corner.
Use setSuggestions(items) on the installed AiAssistantPlugin to change suggested requests. Other public methods include submit, stop, restore, reset, removeStep, applyAction, cancelAction, undoData, redoData and getSnapshot and clearChat. Retrieve the instance with await grid.getPlugins(). A standalone AiViewController also supports subscribe, refresh and destroy; call refresh after host-owned view changes. Stale model results and stale prepared actions are rejected rather than applied to changed state.
Supply translations on aiAssistant to localize the controller and mounted UI. AI_UI_MESSAGES from @revolist/ui/ai and AI_VIEW_MESSAGES from Pro enumerate built-in keys, with English fallback. Preserve interpolation placeholders such as {count} and {field}. Field labels, suggestions, model messages and custom-action text remain application-owned. Standalone UI components accept their own translations prop.
Next: Set up the AI backend.
Mount in a configurator
Section titled “Mount in a configurator”Set aiAssistant.mountTo: false to initialize the controller without adding a header toolbar. Retrieve the initialized AiAssistantPlugin through await grid.getPlugins() and call createAiConfiguratorSection(assistant) from @revolist/revogrid-pro. Add the returned section to the Grid, Pivot or Pivot Charts configurator’s sections configuration.
The helper uses the existing controller and shared chat UI. It defaults to a full-height chat, with the transcript scrolling above the bottom composer, and hides Restore/Reset, Clear chat and data history controls. Customize the tab label/visibility with the section options, and opt into those controls through ui.showHistoryControls: true. Other assistant mounts keep their default presentation.
For another application-owned surface, assistant.mount(host, uiOptions) returns { destroy() }. Destroy that handle when its view unmounts; the controller stays available to other surfaces. Destroying the plugin releases every mounted surface. See custom section lifecycle and examples.