web-chatbot-sdk
v1.0.4
Published
A lightweight SDK for embedding a customizable chatbot into your web applications.
Downloads
5
Readme
Web Chatbot SDK
A lightweight SDK for embedding a customizable chatbot into your web applications.
Installation
npm install web-chatbot-sdkQuick Start
Add the container div to your HTML:
<div id="chatbot-container"></div>Import and initialize the SDK:
import { ChatbotSDK } from 'web-chatbot-sdk';
const chatbot = new ChatbotSDK({
containerId: 'chatbot-container',
width: '350px',
height: '600px',
position: 'fixed',
bottom: '20px',
right: '20px',
url: 'http://47.236.204.213:3002'
});
chatbot.init();Configuration Options
| Option | Type | Default | Description | |--------|------|---------|-------------| | containerId | string | required | ID of the HTML element where the chatbot will be mounted | | width | string | '350px' | Width of the chatbot window | | height | string | '600px' | Height of the chatbot window | | position | string | 'fixed' | CSS position property | | bottom | string | '20px' | Bottom spacing | | right | string | '20px' | Right spacing | | url | string | required | Backend service URL |
Web 聊天机器人 SDK
一个轻量级的 SDK,用于在网页应用中嵌入可定制的聊天机器人。
安装
npm install web-chatbot-sdk快速开始
在 HTML 中添加容器 div:
<div id="chatbot-container"></div>导入并初始化 SDK:
import { ChatbotSDK } from 'web-chatbot-sdk';
const chatbot = new ChatbotSDK({
containerId: 'chatbot-container',
width: '350px',
height: '600px',
position: 'fixed',
bottom: '20px',
right: '20px',
url: 'http://47.236.204.213:3002'
});
chatbot.init();配置选项
| 选项 | 类型 | 默认值 | 说明 | |--------|------|---------|-------------| | containerId | string | 必填 | 聊天机器人挂载的 HTML 元素 ID | | width | string | '350px' | 聊天窗口宽度 | | height | string | '600px' | 聊天窗口高度 | | position | string | 'fixed' | CSS position 属性 | | bottom | string | '20px' | 底部间距 | | right | string | '20px' | 右侧间距 | | url | string | 必填 | 后端服务 URL |
