Skip to main content

SDK integration

Create a bot

The process of creating a robot has been introduced in detail in the previous article, including three function tabs. Below is the content of the third tab page.

Authorized knowledge space

The knowledge base member authorization content has been introduced before. Only after authorization is completed, the robot can answer questions normally.

Copy code

Under the "Robot Management" menu, click to enter the robot that needs to be created (or edited)

robot-manage

On the created (or edited) robot page, click "Installation Code" -> Click "Click to Copy" to copy the installation code

copy-code

Quote SDK script

Add the following code (copied in the previous step) to the required page

<script src="https://console.aid.daxue.cloud/AIDSDK.js"></script>
<script>
// init your chatbot
window.AIDO = new AID({
rid: 'Your chatbot ID',
AUID: 'Your system userID',
AUNM: 'Your system userName',
env: 'development',
showHeader: true,
showFullscreen: true,
showVerticalFullScreen: false,
showClose: true,
robotSource: 'jssdk'
})
// destroy
// window.AIDO.destroy()
</script>

Initialization parameter description

// window.AIDO = new AID(options)
// options: {rid: 'xxx'}
KeyDescribeDefault valueIs it required?
ridYour robot ID-Yes
AUIDThe system generates your user ID-Yes
AUNMThe system generates your user name-Yes
envenvironmentprod [development,unitest,prod]NO
showHeaderWhether to display the headerfalseNO
showFullscreenWhether to display the maximize button in the HeaderfalseNO
showVerticalFullScreenWhether to display the vertical maximize button in the headerfalseNO
showCloseWhether to display the close button in the HeaderfalseNO
domIdIf you want to render it into a certain dom, it is the id of the dom-NO(required when rendering to DOM)
extInfoAdd some additional information'{"nickname":"xxx", xxx: "xxx"}'NO

Please note: AUID can fill in the user's mobile phone number, email address, or employee number in "Member Management" under "Organizational Structure"; the system generates a user ID, which is the same as the other three values. AUNM represents the name of the current user, but this parameter will be removed later. Please do not rely on this information. It is currently only displayed in the lower left corner of the dialog window.

Method

// Destroy
window.AIDO.destroy()

Note

The parameters of AUID and AUNM are related to the authorization of knowledge content. If filled in incorrectly, the robot will not be able to answer the corresponding content.

Embed effect

Effect after embedding SDK

embedding SDK


Floating small window effect

Floating small window


Maximize window effect

Maximize window effect


Vertically maximize window effect

Vertically maximize window