Skip to main content

Using AI Assistant in Component Pages

After using AI Assistant in component pages, an AI dialog box will be displayed on the right side of the page. The page can also subscribe to AI Assistant events to enable interaction between the page and AI, as well as collaboration between users and AI.

Enabling AI Assistant

Follow these steps:

Loading...

​Enable and select an AI Assistant at the top of the page editor.​​

AI assistant configuration

After enabling the AI Assistant, an AI Assistant configuration panel will be displayed on the right side of the page editor with the following configuration options:

  • AI Assistant: Switch the AI assistant used in the page
  • Welcome Message and Opening: Set personalized welcome message and opening
  • Set the input args: If the assistant being used has custom input args configured, these args need to be assigned values.
  • Output Process Log: Customize the runtime log content output by the assistant during runtime.

Loading...

AI assistant event subscription

Subscribe to Node Running Events

After enabling Trigger page events for nodes in the assistant, there will be two events: Arrived and Post-execution. The page subscription method is as follows:

Loading...

Within the event handler, you can access the event's payload:

Loading...

Subscribe to Tool Call Events

After enabling Tool call events for AI Agent nodes in the assistant, there will be two events: Tool Pre-call and Tool Post-call. The page subscription method is as follows:

Loading...

Currently, output parameters of tool call events cannot be used in visual tools and need to be used by developers through code writing in source code mode. The usage method is as follows:

this.subscribeEvent("AI:aiagents.ClientManagementagent.callTool.preEvent", async ({ data}) => {
// AI: Fixed prefix for AI assistant events; aiagents.ClientManagementagent: Node ID in the assistant; callTool.preEvent: Before tool call event, callTool.postEvent: After tool call event
// data: Parameters carried by this tool event
if(data.toolName.value === "services.ASvc.func1"){
//TODO: If tool name is xxxx, do something
}
});

Subscribe to action in conversation node events

Pages can subscribe to action in conversation node events. The subscription method is as follows:

Loading...

Subscribe to action in page node events

Pages can subscribe to action in conversation node events. The subscription method is as follows:

Loading...

Send AI messages in pages

After using AI Assistant in a page, there will be a Send AI Message function on the page. The calling method is as follows:

Loading...

For function parameters, see Send AI Message Function

Direct call to AI assistant

Additionally, pages support directly calling AI Assistant without enabling it. The AI Assistant provides a Run method that can be called directly. The calling method is as follows:

Loading...

This method can also be called in service/model function logic.

JitAI AssistantBeta
Powered by JitAI