hongk efa6c43b2c refactor(AIRobot): 优化消息展示逻辑 1 هفته پیش
..
api e85410f3f6 feat:init 2 هفته پیش
components efa6c43b2c refactor(AIRobot): 优化消息展示逻辑 1 هفته پیش
img e85410f3f6 feat:init 2 هفته پیش
styles e85410f3f6 feat:init 2 هفته پیش
utils e85410f3f6 feat:init 2 هفته پیش
AIRobot.vue efa6c43b2c refactor(AIRobot): 优化消息展示逻辑 1 هفته پیش
README.md e85410f3f6 feat:init 2 هفته پیش
index.js e85410f3f6 feat:init 2 هفته پیش
package.json efa6c43b2c refactor(AIRobot): 优化消息展示逻辑 1 هفته پیش
vite.config.js e85410f3f6 feat:init 2 هفته پیش

README.md

AI管家

一款智能问答机器人模块。

使用方式

  1. 安装依赖

本地npm仓库 verdaccio+docker搭建

npm install ai-robot
  1. 在需要展示ai管家的地方引入并使用:

    <AIRobot ref="AIRobotRef" @onMessage="onMessage" />
    
    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: '开小差了~暂时无法回答您的问题' })
    })
    }
    
    
    
  2. 支持移动端和web端展示,(一套代码,两种样式)

属性

|字段|说明|默认值| |-|-|-|

事件

事件名 说明 默认值
onMessage 返回到用户输入内容

方法

事件名 说明 默认值
handleResponse 执行ai管家的回复 Object

示例:

AIRobotRef.value.handleResponse({ text: '回答内容' })

相关模块

  1. 支持语音转写,采用讯飞平台相关功能