@wandox/sdk 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -29
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
# @wandox/sdk
|
|
2
2
|
|
|
3
|
-
Wandox 可嵌入式 AI 工作台与剧本执行 SDK。npm 包与 CDN/UMD 产物使用同一个 `packages/sdk/src/index.tsx` 入口和同一次构建结果。
|
|
4
|
-
|
|
5
3
|
## 安装
|
|
6
4
|
|
|
7
5
|
```bash
|
|
@@ -24,36 +22,14 @@ const sdk = wandox.init({
|
|
|
24
22
|
sdk.mountAssistant('#app')
|
|
25
23
|
```
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
应用卸载时清理 SDK:
|
|
28
26
|
|
|
29
27
|
```ts
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
SDK 自带运行时依赖,宿主项目无需额外安装 React 或 Ant Design。应用销毁挂载页面时应调用 `sdk.destroy()` 清理 React Root、请求缓存和事件绑定。
|
|
34
|
-
|
|
35
|
-
## CDN / UMD
|
|
36
|
-
|
|
37
|
-
```html
|
|
38
|
-
<link rel="stylesheet" href="/wandox/last/wandox.css">
|
|
39
|
-
<script src="/wandox/last/wandox.umd.js"></script>
|
|
40
|
-
<script>
|
|
41
|
-
const sdk = window.wandox.init({
|
|
42
|
-
token: 'YOUR_SSO_TOKEN',
|
|
43
|
-
domain: 'maiduo'
|
|
44
|
-
})
|
|
45
|
-
sdk.mountAssistant('#app')
|
|
46
|
-
</script>
|
|
28
|
+
sdk.destroy()
|
|
47
29
|
```
|
|
48
30
|
|
|
49
|
-
|
|
31
|
+
命名导入及类型导入:
|
|
50
32
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
```bash
|
|
54
|
-
npm run build:sdk
|
|
55
|
-
npm run pack:sdk
|
|
56
|
-
npm run publish:sdk
|
|
33
|
+
```ts
|
|
34
|
+
import { wandox, type WandoxConfig } from '@wandox/sdk'
|
|
57
35
|
```
|
|
58
|
-
|
|
59
|
-
`build:sdk` 先生成 `packages/sdk/dist`,随后将同一份产物同步到 `public/wandox/last`。
|