Recommended Actions Integration

Recommended Actions Integration

For use cases where Champion would need to interact with the client application.

Table of Contents

Steps

If the use case requires it, Champion can recommend actions to take within the Client application. For example, Champion might suggest navigating to a specific page or selecting a component of the Client application. The possibilities are endless, as long as the Client application supports them.

  1. Action Determination: Identify what actions the client application can support, such as navigation, element selection, or filter creation.
  2. Define actions: Specify these actions in the agent response so the agent can recommend them.
  3. Implementation: Implements the defined actions within the client application. The response will always contains an actionType and a payload.

Sequence Diagram

Code Examples

Define the ChampionActionType in the champion initialization script:

enum ChampionActionType {
  NAVIGATION = 'NAVIGATION',
  ...
}

Implement the championNeedAction method in the champion initialization script:

window.championNeedAction = (type: ChampionActionType, payload: any) => {
  if (type === ChampionActionType.NAVIGATION) {
    router.push('/home-page' + payload.url)
  }
  ...
}