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

@mu-cabin/ai-beeper

v1.0.10

Published

AI utility functions for frontend applications

Readme

AI Beeper

一个 AI-Beeper bot 对话框工具,提供可拖拽和自定义的 AI 聊天界面。

Installation 安装

npm install @mu-cabin/ai-beeper
# or
yarn add @mu-cabin/ai-beeper
# or
pnpm add @mu-cabin/ai-beeper

Usage 使用方法

Token Generation 令牌生成

获取 token 请访问: http://10.73.202.13:8080/share/token

Basic AIChat Implementation 基础 AIChat 实现

import { AIChat } from '@mu-cabin/ai-beeper';

// Create a new AIChat instance
// 创建一个新的 AIChat 实例
const aiChat = new AIChat({
  token: 'auth-token', // 认证令牌,从 http://10.73.202.13:8080/share/token 获取
  baseUrl: 'https://your-api-url.com', // 可选,AI-beeper URL,一般不用填写
  draggable: true, // 可选,是否可拖拽,默认为 true
  trigger: 'click', // 可选,触发方式:'click' 或 'hover',默认为 'click'
  width: 600, // 可选,弹出框宽度
  height: 600, // 可选,弹出框高度
  lazyLoad: true, // 可选,是否懒加载
  position: { // 可选,初始位置
    x: 'calc(100% - 100px)', // 距离右边 100px
    y: 'calc(100% - 100px)', // 距离底部 100px
  },
});

// Clean up when done
// 使用完毕后清理
aiChat.destroy();

React Integration Example React 集成示例

import React, { useRef, useEffect } from 'react';
import { AIBeeper } from '@mu-cabin/ai-beeper';

const AIChatComponent = () => {
  const instanceRef = useRef<AIBeeper | null>(null);

  useEffect(() => {
    instanceRef.current = new AIBeeper({
      token: 'auth-token', // 认证令牌,从 http://10.73.202.13:8080/share/token 获取
      draggable: true,
      trigger: 'click',
      position: {
        x: 'calc(100% - 100px)',
        y: 'calc(100% - 100px)',
      },
    });

    return () => {
      instanceRef.current?.destroy();
    };
  }, []);

  return null; // The chat interface will be rendered as a floating element
  // 聊天界面将作为浮动元素渲染
};

Configuration Options 配置选项

The AIChat class accepts the following configuration options: AIChat 类接受以下配置选项:

| Option 选项 | Type 类型 | Default 默认值 | Description 描述 | |------------|-----------|---------------|-----------------| | token | string | required 必填 | Authentication token 认证令牌,从 http://10.73.202.13:8080/share/token 获取 | | baseUrl | string | 'http://10.73.202.13:8080' | Base URL for the chat API 聊天 API 的基础 URL | | width | number | 600 | Width of the chat popover 聊天弹出框宽度 | | height | number | 600 | Height of the chat popover 聊天弹出框高度 | | draggable | boolean | true | Whether the chat button is draggable 聊天按钮是否可拖拽 | | trigger | 'hover' | 'click' | 'click' | How to trigger the chat popover 如何触发聊天弹出框 | | popoverStyle | CSSStyleDeclaration | - | Custom styles for the popover 弹出框的自定义样式 | | buttonStyle | CSSStyleDeclaration | - | Custom styles for the chat button 聊天按钮的自定义样式 | | content | HTMLElement | string | - | Custom content for the chat button 聊天按钮的自定义内容 | | lazyLoad | boolean | true | Whether to lazy load the iframe content 是否懒加载 iframe 内容 | | iconAnimation | boolean | true | Whether to enable the bot icon animation (breathing/bounce effect) 是否启用机器人图标动画(呼吸/弹跳效果) | | position | { x: string | number, y: string | number } | - | Initial position of the chat button. Supports CSS calc() expressions, percentages, viewport units, and pixel values 聊天按钮的初始位置。支持 CSS calc() 表达式、百分比、视口单位和像素值 |

Position Examples 位置示例

// Using calc() expressions
position: {
  x: 'calc(100% - 100px)', // 距离右边 100px
  y: 'calc(100% - 100px)', // 距离底部 100px
}

// Using percentages
position: {
  x: '50%',  // 水平居中
  y: '50%',  // 垂直居中
}

// Using viewport units
position: {
  x: '75vw', // 视口宽度的 75%
  y: '25vh', // 视口高度的 25%
}

// Using pixel values
position: {
  x: '20px', // 距离左边 20px
  y: '20px', // 距离顶部 20px
}

Project Structure 项目结构

ai-beeper/
├── src/                    # 源代码目录
│   ├── AIChat.ts          # AIChat 类主实现
│   ├── Popover.ts         # 弹出框组件实现
│   ├── utils.ts           # 工具函数
│   └── index.ts           # 包入口文件
├── preview/               # 预览和示例组件
├── dist/                 # 编译输出目录
├── package.json          # 项目配置文件
├── tsconfig.json         # TypeScript 配置
└── README.md             # 项目说明文档

Development 开发

  1. Clone the repository 克隆仓库
  2. Install dependencies 安装依赖:
    pnpm install
  3. Build the package 构建包:
    pnpm build
  4. Run tests 运行测试:
    pnpm test

License 许可证

MIT