npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@krytabo/ai-chat-vue3

v0.1.8

Published

Vue 3 UI widget for AI Chat.

Downloads

593

Readme

@krytabo/ai-chat-vue3

安裝

yarn add @krytabo/ai-chat-vue3

Live2D 資源

Live2D 模型與 live2dcubismcore.min.js 需要被放到「使用者專案」的 public/Live2D 才能透過 URL 取得。

套件安裝時會自動複製到 public/Live2D。在 monorepo 環境下,若偵測到 apps/vue3/public,會優先複製到該位置。你也可以手動執行:

npx ai-chat-vue3-copy-live2d

如果你的 public 不在專案根目錄,可用 --dest 指定:

npx ai-chat-vue3-copy-live2d --dest /path/to/your/project

也可以用環境變數控制:

AI_CHAT_VUE3_ASSETS_DEST=/path/to/your/project npx ai-chat-vue3-copy-live2d
AI_CHAT_VUE3_ASSETS_DISABLE=1 npx ai-chat-vue3-copy-live2d

Vite 設定(常見 CJS/ESM 相容問題)

若在使用 Vite 專案出現類似 does not provide an export named 'default' 的錯誤,請加入以下設定:

// vite.config.(js|mjs)
export default defineConfig({
  optimizeDeps: {
    include: ["object-assign", "url", "eventemitter3", "earcut"]
  },
  ssr: {
    noExternal: ["@krytabo/ai-chat-vue3"]
  }
});

Live2D Core 引入

請在專案的 index.html 加上:

<script src="/Live2D/live2dcubismcore.min.js"></script>

1. 基本用法(懸浮按鈕)

直接在頁面引入,它會自己固定在右下角,可以拖來拖去吸附在瀏覽器邊。

<template>
  <AiChatWidget url="wss://你的後端WebSocket網址/ws/audio" />
</template>

<script setup>
import { AiChatWidget } from "@krytabo/ai-chat-vue3";
</script>

2. 獨立頁面模式(全螢幕)

如果你想要點擊按鈕後,不是打開一個小視窗,而是跳轉到一個獨立的聊天頁面

第一步:在首頁放按鈕 設定 openMode="page",並告訴它要跳轉去哪 (pageUrl)。

<!-- App.vue -->
<AiChatWidget url="wss://..." openMode="page" pageUrl="/ai-chat" />

第二步:建立聊天頁面 在你路由設定的頁面裡(例如 views/AiChat.vue),加上 layout="fullscreen"

<!-- views/AiChat.vue -->
<template>
  <AiChatWidget url="wss://..."  layout="fullscreen" />
</template>

Props

| 參數 | 預設值 | 說明 | | :--- | :--- |:------------------------------------------------| | url | - | 完整的 WebSocket 網址,例如 wss://api.example.com/ws。 | | basePath | /ws | 如果沒給完整 url,就會用目前的網域 + 這個路徑。 | | openMode | panel | panel (展開小面板) 或 page (開新分頁)。 | | pageUrl | /ai-chat | 如果是用 page 模式,要跳轉去哪裡。 | | layout | floating | floating (懸浮按鈕) 或 fullscreen (全螢幕)。 | | mergeAgentResponses | true | 是否將回應內容全部合併成一句話(包含語音) | | maxRecordSeconds | 60 | 錄音最長可以錄幾秒。 |


Slots

| Slot 名稱 | 用途 | 預設內容 | | :--- | :--- | :--- | | fab-label | 懸浮按鈕上的字 | AI | | header-title | 面板最上面的標題 | AI Chat |

範例:

<AiChatWidget ...>
  <template #fab-label>
    <span>客服</span>
  </template>
  <template #header-title>
    智慧小幫手
  </template>
</AiChatWidget>