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)
On the created (or edited) robot page, click "Installation Code" -> Click "Click to Copy" to copy the installation 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'}
Key | Describe | Default value | Is it required? |
---|---|---|---|
rid | Your robot ID | - | Yes |
AUID | The system generates your user ID | - | Yes |
AUNM | The system generates your user name | - | Yes |
env | environment | prod [development,unitest,prod] | NO |
showHeader | Whether to display the header | false | NO |
showFullscreen | Whether to display the maximize button in the Header | false | NO |
showVerticalFullScreen | Whether to display the vertical maximize button in the header | false | NO |
showClose | Whether to display the close button in the Header | false | NO |
domId | If you want to render it into a certain dom, it is the id of the dom. | - | NO(required when rendering to DOM) |
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.