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

@xsai-use/vue

v0.0.3-beta.1

Published

when UI libs meet xsai

Readme

@xsai-use/vue

Vue composables for xsAI.

This package provides a collection of Vue composables for building interactive web applications with powerful features and minimal boilerplate.

Installation

npm install @xsai-use/vue
# or
yarn add @xsai-use/vue
# or
pnpm add @xsai-use/vue

Composables

  • useChat: composable for building chat interfaces

useChat

Parameters

| Parameter | Type | Description | |-----------|------|-------------| | id | string | Unique identifier for the chat | | generateID? | () => string | Function to generate unique IDs for messages | | initialMessages? | Message[] | Initial messages to populate the chat | | onFinish? | () => void | Callback when the chat response completes | | preventDefault? | boolean | Whether to prevent default form submission |

Returns

| Property | Type | Description | |----------|------|-------------| | error | Readonly<Ref<Error | null>> | Error object if an error occurred | | handleInputChange | (e: Event) => void | Handles input changes | | handleSubmit | (e?: Event) => Promise<void> | Handles form submission | | input | Ref<string> | Current input value | | messages | Readonly<Ref<UIMessage[]>> | Array of messages in the conversation | | setMessages | (messages: UIMessage[]) => void | Function to set messages manually | | reload | (id?: string) => Promise<void> | Reloads the last chat response | | reset | () => void | Resets the chat to initial state | | status | Readonly<Ref<'idle' | 'loading' | 'error'>> | Current status of the chat | | stop | () => void | Stops the current response generation | | submitMessage | (message: InputMessage) => Promise<void> | Submits a message programmatically |

Usage

More examples in examples

Usage Example

<script setup lang="ts">
import { useChat } from '@xsai-use/vue'

const {
  handleSubmit,
  handleInputChange,
  input,
  messages,
  status,
  error,
  reset,
  stop,
  reload,
} = useChat({
  id: 'simple-chat',
  preventDefault: true,
  initialMessages: [
    {
      role: 'system',
      content: 'you are a helpful assistant.',
    },
  ],
  baseURL: 'https://api.openai.com/v1/',
  model: 'gpt-4.1',
  maxSteps: 3,
})
</script>

<template>
  <div>
    <div
      v-for="(message, index) in messages"
      :key="message?.id || index"
    >
      <div>{{ message.role }}</div>
      <div>{{ message.content }}</div>
      <div v-if="index === messages.length - 1 && status === 'error'">
        ❌ {{ error?.message }}
        <button @click="reload()">
          Reload
        </button>
      </div>
    </div>

    <form @submit="handleSubmit">
      <input
        type="text"
        placeholder="say something..."
        :value="input"
        :disabled="status !== 'idle'"
        @input="handleInputChange"
      >
      <button
        :type="status === 'loading' ? 'button' : 'submit'"
        @click="status === 'loading' ? stop() : undefined"
      >
        {{ status === 'loading' ? 'Stop' : 'Send' }}
      </button>
      <button type="button" @click="reset">
        Reset
      </button>
    </form>
  </div>
</template>

License

MIT