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

vue-ai-chat-ui

v0.0.1

Published

基于 Vue 3 的 AI 智能问答 UI 组件库

Readme

Vue AI Chat UI

一个基于 Vue 3 的 AI 智能问答 UI 组件库,专注于提供流畅的对话体验。 风格模仿饿了么 UI (Element Plus),简洁美观。

✨ 特性

  • 💬 对话框 (ChatBox): 支持消息历史展示,内置 Markdown 渲染和代码高亮。
  • ⌨️ 输入框 (ChatInput): 支持多行文本、文件上传、自动调整高度。
  • 🌊 流式响应: 内置流式打字机效果(光标动画),完美适配 AI 生成式回复。
  • 🎨 可定制: 样式易于覆盖 (SCSS),开箱即用。

📦 安装

npm install vue-ai-chat-ui
# 或者
yarn add vue-ai-chat-ui

🚀 快速开始

引入组件和样式

在你的主入口文件(如 main.ts)中全局注册:

import { createApp } from 'vue'
import App from './App.vue'
import { ChatBox, ChatInput } from 'vue-ai-chat-ui'
import 'vue-ai-chat-ui/style.css'

const app = createApp(App)
// 全局注册
app.component('ChatBox', ChatBox)
app.component('ChatInput', ChatInput)
app.mount('#app')

或者在组件中直接引入:

<script setup>
import { ref } from 'vue'
import { ChatBox, ChatInput } from 'vue-ai-chat-ui'
import 'vue-ai-chat-ui/style.css'

const messages = ref([
  { role: 'assistant', content: '你好!我是你的 AI 助手,有什么可以帮你的吗?' }
])

const handleSend = ({ text, file }) => {
  messages.value.push({ role: 'user', content: text })
  // 这里处理 API 调用...
}
</script>

<template>
  <div style="height: 500px; display: flex; flex-direction: column;">
    <ChatBox :messages="messages" />
    <ChatInput @send="handleSend" />
  </div>
</template>

📚 组件 API

ChatBox (对话容器)

| 属性名 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | messages | Array | [] | 消息列表,格式:{ role: 'user'\|'assistant', content: string, streaming?: boolean } | | loading | Boolean | false | 是否显示加载中状态(对方正在输入) | | autoScroll | Boolean | true | 是否在收到新消息时自动滚动到底部 |

ChatInput (输入框)

| 属性名 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | placeholder | String | '请输入内容...' | 输入框提示文本 | | disabled | Boolean | false | 是否禁用输入框 | | allowFile | Boolean | true | 是否显示文件上传按钮 | | allowMultiline | Boolean | true | 是否允许通过 Shift+Enter 换行(Enter 发送) | | rows | Number | 2 | 输入框初始行数 |

🔔 事件

ChatInput

  • send: 用户点击发送或按回车时触发。回调参数: { text: string, file: File | null }
  • file-change: 用户选择了文件时触发。

🧩 插槽 (Slots)

ChatBox

  • user-avatar: 自定义用户头像内容。
  • assistant-avatar: 自定义助手头像内容。