Skip to content

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 ​

PropertyTypeDefaultDescription
SettingsTHelpChatSettingsEverything the engine needs: provider, language, index, the model sections, Remote. See the Settings reference
ActiveBooleanFalseStarts engine, transport and hooks. Set at design time it applies when the form is loaded at runtime
RegisterHelpViewerBooleanTrueRegister the chat as the help viewer of the application (ICustomHelpViewer): F1 on a control with help, Application.HelpKeyword, HelpShowTableOfContents
HandleF1BooleanTrueF1 opens the chat also where nothing declares help
Captionstring(empty)Title of the window the chat opens in when it is not embedded. Empty = the localized "Help" / "Aiuto"
AssistantNamestring(empty)What the assistant is called, written in the header of the panel next to its icon. Empty = the localized "Assistant" / "Assistente"
ShowBubbleBooleanTrueThe round button with the assistant icon, in the bottom-right corner of the host form
ImagesTCustomImageListnilImage list holding the bubble icon; nil uses the icons compiled into the component
ImageIndexTImageIndex-1Bubble icon by position
ImageNameTImageName(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 methodWhat it answers
ResolvedCaption: stringThe title actually used: Caption, or the localized default
ResolvedAssistantName: stringThe name actually used
AssistantIconDataUri: stringThat icon as the data:image/png URI the page loads
ApplyAssistantRe-reads all of it and pushes it to the panel; called for you when any of those properties changes
VoiceEngineTHelpChatVoiceEngine
ConfigFileNameTFileName
ActionsEnabledBoolean
FollowVclStyleBoolean
RememberPanelPositionBoolean
ContainerTWinControl
PanelWidthInteger
PanelHeightInteger

Published events ​

EventSignatureWhen
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 ​

MethodDescription
OpenOpens the panel with the context of the current screen
OpenForCurrentScreenOpens 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
CloseHides the chat (the conversation stays)
ToggleOpen if closed, close if open
IsPanelVisible: BooleanWhether the chat is on screen
OpenDocPage(APage)Opens a page of Settings.DocFolder in the documentation view of the panel
BuildContext: THelpChatContextBuilds the context now (fires OnGetContext)
BuildTheme: THelpChatThemeThe theme that would be applied (fires OnGetTheme)
ApplyThemeRecomputes the colours and pushes them into the open page
ActiveControlHasHelp: Booleanclass function — whether the focused control or a parent declares help

Public properties ​

PropertyTypeDescription
ActionsTHelpChatActionBrokerThe registry of what the assistant may do. Available from the constructor
EngineTHelpChatEngineThe engine, while active (nil before, and idle with a remote server)
TransportIHelpChatTransportThe local server or the remote client
ViewTVclHelpChatPanelThe chat control (the WebView2 host), wherever it is parented
OwnFormTVclHelpChatFormThe component's own window, when not embedded
ActiveContainerTWinControlWho is hosting the chat right now
HostFormTCustomFormForm 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;

Released under the Apache License 2.0