clickzetta-datagpt-bot-sdk
v0.0.9
Published
## Install
Downloads
7
Readme
clickzetta-datagpt-bot-sdk
Install
npm install clickzetta-datagpt-bot-sdk
Usage
import { DataGPTWebSDK } from "clickzetta-datagpt-bot-sdk";
new DatagptWebSdk({
getToken: () => {
return new Promise((resolve, reject) => {
setTimeout(() => {
try {
resolve({
token: "",
tenantId: "1",
userId: 1,
expireMillisecond: "1721468669950",
});
} catch (error) {
reject("Failed to get token");
}
}, 1000);
});
},
instanceName: "xxx",
env: "shanghaiAlicloud",
mode: "popover",
});
Options
| Name | Type | Description | Default | | ------------ | ----------------------------------------- | -------------------------------------- | -------------------- | | getToken | ()=>Promise<IToken> | 必填,获取 token 等配置信息 | - | | instanceName | string | 必填,环境地址前缀 | - | | env | "shanghaiAlicloud" |"southeastAlicloud"" | 必填,环境 | - | | mode | "popover" |"normal" | 展示模式,normal 下 父级最小宽度>500px | "normal" | | mode | () => HTMLElement | 渲染父节点 | 默认为 body | | id | string | 选择器 Id | 默认为 DataGPTWebSDK |
API
| Name | Type | Description | | -------------- | ------------------ | --------------------------------------------------------- | | syncCookie | (v?:IToken)=>void | 更新 token 等参数,不传参数则调用 getToken 获取 token 配置 | | toggleModalVis | (v?:boolean)=>void | mode: "popover"下切换弹窗显示隐藏 |