Skip to content

RobotChat ​

VRobotChat is a Wevu wrapper for the chatbotwidget Mini Program plugin. It supports only the weapp target and provides initialization states, event forwarding, and an editable input area.

Demo ​

Weapp-only plugin hostVRobotChat observable preview

Docs cannot load chatbotwidget. This surface shows the same session: welcome, operateCard, send, and queryCallback.

Hello, how can I help?

Status
Robot connected
Last query
No query yet
queryCallback
0
Messages
1

This is the docs/Web Preview host, not WeChat Dialog Open Platform.

The docs site cannot load chatbotwidget. This demo shows welcome text, the operate card, send, and queryCallback. It is the Web Preview host, not WeChat Dialog Open Platform.

Mini-program configuration

Enable the plugin for the Mini Program, then declare it under the fixed varoRobot alias in app.json:

json
{
  "plugins": {
    "varoRobot": {
      "version": "1.1.15",
      "provider": "wx8c631f7e9f2465e1"
    }
  }
}

Use the plugin version enabled for the Mini Program. See the chatbotwidget plugin documentation for configuration details.

Usage ​

vue
<script setup lang="ts">
import type { VaroRobotChatOptions } from '@/components/ui/robot-chat'
import { computed } from 'wevu'
import { VRobotChat } from '@/components/ui/robot-chat'

const props = defineProps<{ robotAppId: string }>()

const options = computed<VaroRobotChatOptions>(() => ({
  appid: props.robotAppId,
  history: true,
  welcome: 'Hello. How can I help?'
}))
</script>

<template>
  <VRobotChat
    :options="options"
    @ready="onReady"
    @error="onError"
    @query-callback="onQuery"
    @back-home="onBackHome"
  />
</template>

Custom input area ​

Edit src/components/ui/v-robot-operate-card.vue after installation. It provides text submission and return actions; the plugin injects focus, inputText, inputing, and height.

VRobotChat-owned API ​

PropTypeDefaultDescription
optionsVaroRobotChatOptionsrequiredPassed to plugin init; appid must be set
classNamestring''Merges with the root class
ariaLabelstring'机器人对话'Accessible name for the conversation region
loadingTextstring'正在连接机器人'Initialization status text
errorTextstring'机器人连接失败'Failure status text
retryTextstring'重新连接'Retry button text

Events ​

EventDescription
readyPlugin initialization succeeded
errorPlugin initialization failed; raw error
queryCallbackForwards the plugin query callback
backHomeForwards the plugin return-home callback

For other initialization options, message types, and event payloads, see the chatbotwidget plugin documentation.