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

ai-client-kit

v2.1.0

Published

一款 AI 集成套件,适配任意前端框架,兼容多种大模型、聊天面板、Function Calling、Agent、工作流等。

Downloads

281

Readme

AI Client Kit

AI Client Kit 是一款 AI 集成套件,方便开发者在任意 Web 应用中接入 AI 功能。

Features

  • 兼容多种大模型
  • AI 聊天面板
  • 配置系统消息
  • 接入自定义工具函数(Function Calling,将 AI 聊天与业务逻辑相结合)
  • 提供一些常用的工具函数(如解析中文语境的相对时间),开发者可按需使用
  • 纯原生实现,技术栈无关,适配任意前端框架(React、Vue 等)及纯 HTML 页面
  • 封装了与大模型交互的基础工具类(Agent class),开发者可基于此构建灵活的工作流

安装

使用 npm 或 yarn

npm install ai-client-kit
# 或
yarn add ai-client-kit

开发

安装依赖

npm install

运行测试

# 运行所有测试
npm run test:run

# 监听模式运行测试(开发时推荐)
npm run test

构建

npm run build

快速开始

初始化 AI 聊天面板

实例化 AIChatPanel 把 Web 端的 AI 聊天面板挂载到指定容器。

示例

import {AIChatPanel} from 'ai-client-kit';

const container = document.getElementById('container');
const panel = new AIChatPanel({container});

参数说明

| Parameter | Type | Required | Description | | ----------- | --------------------- | :------: | ----------------------- | | container | HTMLElement \| null | Y | 聊天面板挂载的 DOM 容器 |

注意事项

  • 在 DOM 准备就绪后实例化 AIChatPanel,确保 container 元素已存在。

内置的工具函数

解析中文语境的相对时间(tools.parse_relative_date)

功能说明

  • 将中文语境的相对时间转为绝对时间
  • 支持中文语境的相对时间,如"明天"、"后天"、"大后天"、"本周三"、"下周一下午 3 点"等
  • 返回格式化的时间字符串(YYYY-MM-DD HH:mm:ss)

使用示例

  • 用户输入:"明天下午 3 点开会"
  • 大模型调用工具函数解析后返回:"2024-01-16 15:00:00"

License