# AI管家 一款智能问答机器人模块。 ### 使用方式 1. 安装依赖 > 本地npm仓库 verdaccio+docker搭建 ``` npm install @component-lib/ai-robot ``` 2. 在需要展示ai管家的地方引入并使用: ``` import AIRobot from 'ai-robot' import request from 'axios' import { ref } from 'vue' const AIRobotRef = ref() // 用户输入的内容 const onMessage = (message) => { console.log('onMessage', message) request .post('xxx') .then((res) => { const answer = res.data.answer AIRobotRef.value.handleResponse({ text: answer }) }) .catch((err) => { console.log(err) AIRobotRef.value.handleResponse({ text: '开小差了~暂时无法回答您的问题' }) }) } ``` 3. 支持移动端和web端展示,(一套代码,两种样式) ### 属性 |字段|说明|默认值| |-|-|-| ### 事件 | 事件名 | 说明 | 默认值 | |-----|-----------|--------| | onMessage | 返回到用户输入内容 | Object | ### 方法 | 事件名 | 说明 | 默认值 | |-----|-----------|--------| | handleResponse | 执行ai管家的回复 | Object | 示例: ``` AIRobotRef.value.handleResponse({ text: '回答内容' }) ``` ### 相关模块 1. 支持语音转写,采用讯飞平台相关功能 2. 相关依赖:`crypto-js`项目需要安装此依赖