SmartCopilotAdapter
Overview
Turns a ChatBox control into an AI-powered assistant, enhancing its capabilities to manage and navigate an application. It can perform tasks such as clicking on menu items, navigation bar elements, buttons, and more. Additionally, it provides the ability to invoke methods within your applications through the use of custom tools.
The adapter uses the associated ChatBox control to identify the top-level control, such as a Form, Page, or Desktop. Once identified, it crawls the following set of controls to construct a map of actionable items that it can execute in response to a user prompt:
NavigationBar: A component typically used for navigation through different sections or views within the application.
MenuBar: This control generally provides access to application-wide commands and functions organized in a menu format.
ToolBar: A toolbar usually includes buttons for quick access to frequently used commands and tools.
RibbonBar: Often a more advanced control providing a tabbed bar interface with grouped commands, improving accessibility and user experience.
The adapter utilizes the Name
, Text
, and TooltipText
properties of each control to enrich the action map, enabling the AI model to make informed decisions about which action to invoke based on a user prompt.
This is the built-in prompt:
At present, the system does not support selecting multiple choices when a user request potentially qualifies more than one action
To enhance the capabilities of the adapter, you can simply integrate additional tools. For example, if you wish to enable users to perform tasks such as typing "Send an email to...", you would add an email tool to the adapter.
Configuration
Properties
User
Represents the AI user in the ChatBox as an instance of the ChatBox.User class. This property is read-only and identifies the AI participant within the chat interface. To customize the AI’s display name or avatar, use the BotName and BotAvatar properties, respectively. The property itself cannot be reassigned, but you can modify the AI user's appearance through these options.
BotName
The BotName property specifies the display name of the AI bot within the ChatBox. By default, this name is set to "Wisej." You can use this property to assign a custom name to your bot, allowing you to better personalize the chat experience for your application’s users.
BotAvatar
The BotAvatar property specifies the image that represents the AI bot in the ChatBox. You can set this property to either the name of a built-in image or the URL of a custom image. This allows you to personalize the bot's appearance by displaying a specific avatar in the chat interface.
ChatBox
The ChatBox property is read-only and returns the instance of the ChatBox control associated with the adapter. This association is established when you call this.smartHub.GetAI(this.chatBox)
and assign the adapter using this.smartHub.GetAI(this.chatBox).Adapter = this.smartChatBoxAdapter
. The property provides access to the specific ChatBox control that is linked to the current AI adapter instance.
Events
ExecuteAction
The ExecuteAction event is triggered after the adapter identifies the target component but before any action is taken. You have the option to handle this event and set e.Handled
to true
if you wish to intercept and execute the requested command yourself.
e.Target
The Wisej.NET component that was identified by the AI model for action.
e.Parameters
A string containg any extra data present in the user prompt.
Last updated