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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@tsailab/xai

v0.2.2

Published

The loto-xai is an openai nodejs sdk compatible extension library.

Downloads

23

Readme

Installation

$ npm install -g @tsailab/xai

Usage

browser front SSE fetch


  // abort request
  let controller = new AbortController()

  // SSE request body data
  const sseBody: XaiStreamableRequestData = {
    controller,
    chatid: 'xai-chatid-001', // required string ,your front app chat id
    provider: 'deepseek', // which provide api service 
    model, // model id 
    uuid, // required number 
    // text: prompt.value, front user input text or handler messages 
    messages: [ // see openai message
      {
        role: 'user',
        content: 'who are you?', 
      },
    ],
  }

  // the SSE streamable response chunk appending text
  let fullResult:string = ''

  const sseClient = new XaiSseFetch(
    apiPath:'http://127.0.0.1:8964/v1',
    { 
      apiBasePrefix:'chat/completions',
      eventDataParsed:true, // control return chunk parsed to JSON Object OR string
      debug: true, // if true will print some log
      // handle streamable chunk content,add update chat result text typed.
      onmessage:(chunk:any) => {
        console.log(chunk, `onMessage>>>>>>>>>>>${typeof chunk}`)
        // if eventDataParsed=false chunk is string
        try{
          const {content} = JSON.parse(chunk)

          fullResult = fullResult + content
        }catch(_){

        }

        // if eventDataParsed=true chunk is object
        fullResult = fullResult + chunk.content

      },
      onerror: (err: any) => {
        console.log(err, '<<<<<>>>>Error>>>>')
      },
      oncancel: () => {
        console.log('>>>>>>>>>>>>>Cancel>>>>>>')
      },
      onclose: () => {
        console.log('>>>>>>>Closed>>>>>')
      },
    }
  )

  // launch SSE fetch
  await cli.connect(sseBody, (cache: any) => {
      // first connect handle ssebody merge remote model options 
      console.log('>>>>>>> preconnect>> cache>>>', cache)
  })

front localstore helper

newChatbotAgent(...)
createNewUserMessage(...)
createInitAssistantMessage(...)
updateSomeChatbotMessage(...)

Contribution

the Code submission specifications follow angular standards

you can visit rules link,see more infomation.


Stay in touch

:revolving_hearts::revolving_hearts::revolving_hearts: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand::raising_hand::raising_hand::revolving_hearts::revolving_hearts::revolving_hearts:

Sincerely invite experts to improve the project functions together !

:revolving_hearts::revolving_hearts::revolving_hearts: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand: :raising_hand::raising_hand::raising_hand::revolving_hearts: :revolving_hearts::revolving_hearts:

License

The @Tsailab/xai packages is MIT licensed.

Give me a cup of coffee? Thanks much.