@xpert-ai/chatkit-vue2

Vue 2 bindings for Xpert Chatkit
3,216 9
Install
npm install @xpert-ai/chatkit-vue2
Latest Version:0.17.0
Vue:2
Last Updated:Oct 21, 2026
Links: GitHub  ·  npm
Maintainer: tiven.wang

@xpert-ai/chatkit-vue2

Vue 2 bindings for the Xpert ChatKit web component.

Install

pnpm add @xpert-ai/chatkit-vue2 vue@^2.7

Usage

Register the ChatKit custom element as ignored in your Vue 2 app entry:

import Vue from 'vue';

Vue.config.ignoredElements = [...Vue.config.ignoredElements, 'xpertai-chatkit'];

Then create a ChatKit control and pass it to the wrapper component:

<template>
  <ChatKit :control="chatkit" style="height: 100vh;" />
</template>

<script>
import { ChatKit, createChatKit } from '@xpert-ai/chatkit-vue2';

export default {
  components: { ChatKit },
  data() {
    return {
      chatkit: createChatKit({
        frameUrl: '<url-to-chatkit-frame>',
        api: {
          apiUrl: 'https://api.xpertai.cn',
          xpertId: 'your-assistant-id',
          getClientSecret: async () => {
            const response = await fetch('/api/create-session', {
              method: 'POST',
              headers: { 'Content-Type': 'application/json' },
            });
            const data = await response.json();

            return {
              secret: data.client_secret,
              organizationId: data.organization_id,
            };
          },
        },
        onReady: () => {
          console.log('ChatKit is ready');
        },
      }),
    };
  },
};
</script>

getClientSecret may continue returning the legacy string, or return { secret, organizationId } to have ChatKit send organization-id on hosted API requests.

Updating Options

createChatKit returns a control object that stores options and exposes the web component methods:

this.chatkit.setOptions({
  frameUrl: '<url-to-chatkit-frame>',
  api: {
    /* ... */
  },
  onReady: () => {},
});

this.chatkit.focusComposer();
this.chatkit.setThreadId('thread-id');
this.chatkit.sendUserMessage({ text: 'Hello' });

Options are replaced, not merged. Pass the full option object whenever you call setOptions.

Related Packages

@xpert-ai/chatkit-vue

Vue bindings for Xpert Chatkit

4,457 9
@dullar/mercury

Advanced and highly reusable Mobile UI Components built on Vue2 & You can define...

8,553 6
@halobear/vue-upload

vue上传组件

460 1
vite-plugin-vue2

Vite plugin for Vue2

1,474,659 618
vue-jstree

a tree plugin for vue2

137,015 630

Version History

Version Released License
0.17.0
0.16.2
0.16.1
0.16.0
0.15.0