Using simple js script (recommended)
- Download the latest build from GitHub and extract the zip file.
-
Include the provided JavaScript file in the head of your document (use
http://localhost:8888/pilot.js
for local setup). -
Init the copilot (when document fully loads) by calling the
initAiCoPilot
function and passing the required options.
As a React Component
-
Install the widget from npm.
- Use the Component inside your application
Options
Available options
Option | Description | type |
---|---|---|
initialMessage | The message that will be first present when the copilot is initialized | string |
token | Your copilot token | string |
triggerSelector | The selector of the element that will trigger the copilot when clicked | string |
apiUrl | the url of the copilot api. | string |
headers | An object of headers that will be sent with every request (can be used to authenticate your api requests) | Record<string,string> |
containerProps | An object of props that will be passed to the container div | Record<string,string> |
socketUrl | The url of the socket url that will be used to send and receive messages | string |
FAQ
The copilot widget is not showing up
The copilot widget is not showing up
Make sure that the
triggerSelector
is correct and the element exists in
the dom,instead you can set defaultOpen
to true
to make the copilot open by default.
if that did not work, please open an issue on our GitHub repoThe copilot widget is so small
The copilot widget is so small
The copilot widget is responsive and itβs width is set to 100% by default of the container, you can change that by passing the
containerProps
option and setting the width to whatever you want.