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

quickapp-agent-generator

v1.0.3

Published

AI-powered QuickApp Agent Generator

Readme

quickapp-agent-generator

AI 驱动的快应用智能体项目生成器。粘贴 curl 命令和响应示例,自动生成完整的快应用聊天项目。

安装

# 全局安装
npm install -g quickapp-agent-generator

# 或直接用 npx(无需安装)
npx quickapp-agent-generator

前置条件

需要一个兼容 OpenAI 接口的 LLM 服务。在你要生成项目的目录下创建 .env 文件:

OPENAI_API_KEY=your-api-key
OPENAI_BASE_URL=https://api.openai.com/v1
MODEL_NAME=gpt-4

也支持自定义请求头(如内部 AI 平台):

OPENAI_API_KEY=your-api-key
OPENAI_BASE_URL=http://your-internal-api/v1
MODEL_NAME=gpt-5
X_MODEL_PROVIDER_ID=azure_openai
X_MODEL_REQUEST_ID=1234

使用

# 进入你想生成项目的目录
cd ~/my-projects

# 运行生成器
npx quickapp-agent-generator

按照交互式提示操作:

  1. 输入项目基本信息 — 项目名称、描述、包名
  2. 粘贴 curl 命令 — 直接从 Postman 或浏览器复制,AI 自动解析 URL、请求头、请求体
  3. 粘贴响应示例 — AI 自动推断字段路径(如 choices[0].delta.content
  4. 配置智能体信息 — 名称、描述、图标、开场问题

生成的项目会直接出现在当前目录下:

my-projects/
└── your-project-name/    ← 生成在这里
    ├── src/
    │   ├── pages/Index/          # 聊天页面
    │   ├── components/           # UI 组件
    │   ├── common/
    │   │   ├── apiConfig.js      # API 配置(AI 生成)
    │   │   ├── api.js
    │   │   ├── apiHelper.js
    │   │   └── request.js
    │   ├── constants/
    │   ├── assets/
    │   ├── app.ux
    │   └── manifest.json
    ├── package.json
    ├── babel.config.js
    ├── hap.config.js
    └── README.md

运行生成的项目

cd your-project-name
npm install
npm run start

示例

粘贴 curl 命令

curl --location 'https://api.openai.com/v1/chat/completions' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer sk-xxx' \
--data '{
  "model": "gpt-4",
  "messages": [
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Hello!"}
  ],
  "stream": true
}'

AI 自动提取:

  • URL、HTTP 方法、所有请求头
  • 完整请求体结构
  • 动态字段识别:messages[user].content{{question}}
  • 静态配置保留:modelstream

粘贴响应示例

data: {"id":"chatcmpl-123","choices":[{"delta":{"content":"你"}}]}
data: {"id":"chatcmpl-123","choices":[{"delta":{"content":"好"}}]}
data: [DONE]

AI 自动推断:

  • 内容路径:choices[0].delta.content
  • 消息 ID:id
  • 流式响应:true

支持的 API 格式

  • OpenAI / Azure OpenAI
  • 通义千问
  • 任意兼容的自定义 API

AI 会自动适配不同的请求体和响应结构,无需手动配置。

常见问题

LLM 连接失败

检查 .env 中的配置:

  • OPENAI_API_KEY 是否正确
  • OPENAI_BASE_URL 是否可访问
  • 网络是否通畅

生成的项目 API 调用异常

检查 src/common/apiConfig.js

  • 请求模板中的占位符是否正确
  • 响应字段路径是否准确
  • API 密钥是否有效

技术栈

  • LangChain + OpenAI — AI 配置解析与模板生成
  • TypeScript — CLI 工具实现
  • 快应用框架 — 目标平台

许可证

MIT