TVclHelpChatAI reference
Unit Vcl.HelpChatAI · package HelpChatAIVcl · palette group Ethea HelpChatAI · Delphi 10.4 and later.
A non-visual component: it owns the engine, the transport, the bubble and the chat panel.
Published properties
| Property | Type | Default | Description |
|---|---|---|---|
Settings | THelpChatSettings | Everything the engine needs: provider, language, index, the model sections, Remote. See the Settings reference | |
Active | Boolean | False | Starts engine, transport and hooks. Set at design time it applies when the form is loaded at runtime |
RegisterHelpViewer | Boolean | True | Register the chat as the help viewer of the application (ICustomHelpViewer): F1 on a control with help, Application.HelpKeyword, HelpShowTableOfContents |
HandleF1 | Boolean | True | F1 opens the chat also where nothing declares help |
Caption | string | (empty) | Title of the window the chat opens in when it is not embedded. Empty = the localized "Help" / "Aiuto" |
AssistantName | string | (empty) | What the assistant is called, written in the header of the panel next to its icon. Empty = the localized "Assistant" / "Assistente" |
ShowBubble | Boolean | True | The round button with the assistant icon, in the bottom-right corner of the host form |
Images | TCustomImageList | nil | Image list holding the bubble icon; nil uses the icons compiled into the component |
ImageIndex | TImageIndex | -1 | Bubble icon by position |
ImageName | TImageName | (empty) | Bubble icon by name: AIAssistant_Male, AIAssistant_Female, Assistant_Male, Assistant_Female |
The icon of the three properties above is also the one the panel draws in its header, left of AssistantName.
| Public method | What it answers |
|---|---|
ResolvedCaption: string | The title actually used: Caption, or the localized default |
ResolvedAssistantName: string | The name actually used |
AssistantIconDataUri: string | That icon as the data:image/png URI the page loads |
ApplyAssistant | Re-reads all of it and pushes it to the panel; called for you when any of those properties changes |
VoiceEngine | THelpChatVoiceEngine |
ConfigFileName | TFileName |
ActionsEnabled | Boolean |
FollowVclStyle | Boolean |
RememberPanelPosition | Boolean |
Container | TWinControl |
PanelWidth | Integer |
PanelHeight | Integer |
Published events
| Event | Signature | When |
|---|---|---|
OnGetContext | (Sender; var AContext: THelpChatContext) | The screen context has been built and can be refined |
OnGetTheme | (Sender; var ATheme: THelpChatTheme) | The colours have been derived and can be adjusted |
OnBeforeShowHelp | (Sender; var AContainer: TWinControl) | Before showing: set AContainer to embed the chat |
OnAfterShowHelp | (Sender) | The chat is visible |
OnBeforeHideHelp | (Sender) | The user closed it: hide your container |
OnAfterHideHelp | (Sender) | After hiding |
OnActionConfirm | (Sender; const AName; const AArgs; var AAllow) | An action marked Confirm is about to run |
OnActionExecuted | (Sender; const AName; const AOutcome; const AResult) | After every action |
OnOpenLink | (Sender; const AUrl; var AHandled) | A link is leaving the panel; set AHandled to open it yourself instead of the system browser |
OnVoiceText | (Sender; var AText; const AFinal) | Dictated text on its way to the box: correct it, or empty it to drop it. AFinal is False for a hypothesis |
OnVoiceConsentNeeded | (Sender; var AHandled) | The recognizer needs the online speech consent; set AHandled to explain it your way |
Methods
| Method | Description |
|---|---|
Open | Opens the panel with the context of the current screen |
OpenForCurrentScreen | Opens it and asks the localized question about this screen (F1) |
OpenForHelp(AKeyword, AContext) | Opens it for a specific keyword or help context id |
OpenWithQuestion(AText, ASend = True) | Opens it and sends AText, or only pre-fills it |
Close | Hides the chat (the conversation stays) |
Toggle | Open if closed, close if open |
IsPanelVisible: Boolean | Whether the chat is on screen |
OpenDocPage(APage) | Opens a page of Settings.DocFolder in the documentation view of the panel |
BuildContext: THelpChatContext | Builds the context now (fires OnGetContext) |
BuildTheme: THelpChatTheme | The theme that would be applied (fires OnGetTheme) |
ApplyTheme | Recomputes the colours and pushes them into the open page |
ActiveControlHasHelp: Boolean | class function — whether the focused control or a parent declares help |
Public properties
| Property | Type | Description |
|---|---|---|
Actions | THelpChatActionBroker | The registry of what the assistant may do. Available from the constructor |
Engine | THelpChatEngine | The engine, while active (nil before, and idle with a remote server) |
Transport | IHelpChatTransport | The local server or the remote client |
View | TVclHelpChatPanel | The chat control (the WebView2 host), wherever it is parented |
OwnForm | TVclHelpChatForm | The component's own window, when not embedded |
ActiveContainer | TWinControl | Who is hosting the chat right now |
HostForm | TCustomForm | Form hosting the bubble and anchoring the window; nil = Application.MainForm. Public and not published: at design time the form of another unit is not a component of this one, so there would be nothing to choose from |
Types you will meet
pascal
THelpChatContext = record
ScreenName, ScreenLabel, ScreenType: string;
HelpKeyword: string;
HelpContext: Integer;
FocusedControl: string;
function DisplayName: string; // the readable name of the screen
function SearchHint: string; // what the retriever searches with
end;
THelpChatTheme = record
Name: string;
IsDark: Boolean;
Background, Surface, Text, Border, Accent: string; // '#rrggbb'
// ...derived colours, filled in automatically
FontFamily: string;
end;Minimal example
pascal
uses HelpChatAI.Types, Vcl.HelpChatAI;
procedure TMainForm.FormCreate(Sender: TObject);
begin
HelpChatAI.Settings.Provider := 'docsearch';
HelpChatAI.Settings.DocIndexFile := TPath.Combine(
TPath.GetDirectoryName(ParamStr(0)), 'help-index.json');
HelpChatAI.Settings.DocBaseUrl := 'https://help.mycompany.com/myapp/';
HelpChatAI.Active := True;
end;