@vjtech/chat-ai

2.2.22 • Public • Published

module-chat-ai

A Vue 2 chat module with Vuex and Tailwind CSS.

Installation

yarn add module-chat-ai

Usage in Vue 2

import Vue from 'vue';
import Vuex from 'vuex';
import ChatAIPlugin, { store } from 'module-chat-ai';
import 'module-chat-ai/dist/module-chat-ai.css';

Vue.use(Vuex);

const appStore = new Vuex.Store({
  modules: {
    chatAI: store
  }
});

Vue.use(ChatAIPlugin, {
  baseAPI: 'https://your-api.com',
  store: appStore
});

new Vue({
  store: appStore,
  render: h => h('chat-ai')
}).$mount('#app');

Usage in Nuxt 2

  1. Add to plugins/chat-ai.js:
import Vue from 'vue';
import ChatAIPlugin, { store } from 'module-chat-ai';

export default ({ store }, inject) => {
  Vue.use(ChatAIPlugin, {
    baseAPI: 'https://your-api.com',
    store
  });
};
  1. Update nuxt.config.js:
export default {
  plugins: [{ src: '~/plugins/chat-ai.js', mode: 'client' }],
  css: ['module-chat-ai/dist/module-chat-ai.css']
};
  1. Use in template:
<template>
  <chat-ai @message-sent="onMessageSent" />
</template>

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @vjtech/chat-ai

Weekly Downloads

8,486

Version

2.2.22

License

none

Unpacked Size

11.3 MB

Total Files

16

Last publish

Collaborators

  • allain1324