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

llm-content-creator

v0.2.0

Published

AI-powered multi-workflow content creation system with support for content generation, translation, and custom workflows

Readme

写作 Agent (Content Creator)

基于 LangGraph 的智能写作 Agent,支持选题搜索、内容生成、质量检查和配图生成,采用 PostgreSQL 数据持久化,支持同步和异步两种执行模式。项目已扩展为支持多工作流架构,包括内容创作和翻译工作流。


🎯 项目概述

这是一个 AI 驱动的内容创作系统,能够自动完成从选题搜索、内容创作、质量检查到配图生成的完整流程。

核心特性

  • ✅ 智能写作:基于 DeepSeek API 的高质量内容生成
  • ✅ 质量检查:硬规则 + LLM 双层质量保证
  • ✅ 配图生成:自动生成匹配文章的插图
  • ✅ 多种模式:同步(立即返回)和异步(后台处理)
  • ✅ 高并发:支持 100 人同时在线,日处理 3000+ 任务
  • ✅ 高可用:多 Worker 架构,自动故障恢复
  • ✅ 多工作流:支持内容创作和翻译工作流,可扩展
  • ✅ 插件化架构:通过 WorkflowRegistry 支持动态添加新工作流

📦 作为 npm 包使用

本项目已发布到 npm,可以直接作为库使用:

# 安装
npm install llm-content-creator

# 或使用 pnpm
pnpm add llm-content-creator

基本使用

import { createSyncExecutor } from 'llm-content-creator/executor';
import { createTaskRepository } from 'llm-content-creator/database';

// 创建执行器
const executor = createSyncExecutor(createTaskRepository());

// 执行内容创作工作流
const result = await executor.execute({
  mode: 'sync',
  topic: 'AI 技术的发展',
  requirements: '写一篇关于 AI 技术发展趋势的文章',
  targetAudience: '技术爱好者',
  tone: '专业',
});

使用多工作流系统

import {
  WorkflowRegistry,
  createWorkflowGraph,
  createWorkflowState,
} from 'llm-content-creator/workflow';

// 使用翻译工作流
const graph = createWorkflowGraph('translation');
const state = createWorkflowState('translation', {
  taskId: 'task-123',
  mode: 'sync',
  sourceText: 'Hello World',
  sourceLanguage: 'en',
  targetLanguage: 'zh',
});

const result = await graph.invoke(state);
console.log(result.translatedText); // 输出: 你好世界

CLI 命令

安装后可以使用全局 CLI 命令:

# 列出所有工作流
content-creator workflow list

# 创建内容创作任务
content-creator create --topic "AI 技术" --requirements "写一篇文章" --mode sync

# 创建翻译任务
content-creator create --type translation \
  --source-text "Hello World" \
  --source-language en \
  --target-language zh \
  --mode sync

更多使用示例,请查看:


📚 文档导航

完整文档请访问:📖 文档中心

核心文档

| 文档 | 说明 | |------|------| | 🚀 快速开始 | 5 分钟快速上手指南 | | 📖 用户操作手册 | 完整的用户使用指南 | | 🏗️ 系统架构设计 | 完整的系统架构(5500+ 行) | | ⚙️ 工作流架构 | LangGraph 工作流详解 | | 🔌 工作流扩展架构 | 多工作流插件化架构设计 | | 🌍 翻译工作流使用 | 翻译工作流详细使用说明 | | ✅ 质量检查架构 | 质量检查系统设计 | | 💾 存储机制说明 | PostgreSQL 数据存储 |

技术参考

| 文档 | 说明 | |------|------| | BullMQ 快速参考 | 任务队列快速入门 | | 监控优化指南 | 系统监控和优化 | | 性能优化指南 | 应用性能调优 |

历史文档

项目开发历史已归档到:📦 docs/archive/


🚀 快速开始

前置要求

  • Node.js 18+ LTS
  • PostgreSQL 14+
  • Redis 7+
  • DeepSeek API Key
  • Doubao API Key(图片生成)

1. 克隆项目

git clone <repository-url>
cd content-creator

2. 安装依赖

pnpm install

3. 配置环境变量

复制 .env.example(如果存在)或创建 .env 文件:

# PostgreSQL
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=content_creator
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_password

# Redis
REDIS_URL=redis://:password@localhost:6379

# DeepSeek API
LLM_BASE_URL=https://api.deepseek.com
LLM_API_KEY=sk-your-api-key
LLM_MODEL_NAME=deepseek-chat

# Doubao API
ARK_API_KEY=your-api-key

4. 验证环境

pnpm run verify-env

预期输出:

✅ 所有检查通过 (4/4)
🎉 环境准备完成,可以开始开发!

5. 数据库迁移

pnpm run db:migrate

6. 启动开发服务器

pnpm run dev

📖 开发指南

项目结构

content-creator/
├── src/
│   ├── domain/              # 领域层(业务逻辑)
│   ├── application/         # 应用层(用例编排)
│   ├── infrastructure/      # 基础设施层
│   ├── services/            # 服务层(外部集成)
│   └── presentation/        # 表现层(CLI/API)
├── tests/                   # 测试
├── migrations/              # 数据库迁移
├── scripts/                 # 工具脚本
└── docs/                    # 文档

可用命令

# 开发
pnpm run dev          # 启动开发服务器(热重载)
pnpm run build        # 构建生产版本
pnpm run start        # 运行生产版本

# 测试
pnpm run test         # 运行所有测试
pnpm run test:unit    # 运行单元测试
pnpm run test:integration # 运行集成测试
pnpm run test:performance # 运行性能测试
pnpm run test:ui      # 测试 UI
pnpm run test:coverage # 测试覆盖率
pnpm run test:watch   # 测试监听模式

# 代码质量
pnpm run lint         # ESLint 检查
pnpm run format       # Prettier 格式化

# 数据库
pnpm run db:migrate   # 运行迁移
pnpm run db:rollback  # 回滚迁移
pnpm run db:status    # 检查迁移状态
pnpm run db:seed      # 填充测试数据

# Worker 和监控
pnpm run worker       # 启动 Worker
pnpm run monitor      # 启动监控面板
pnpm run scheduler    # 启动调度器

# CLI 使用
pnpm run cli          # 显示 CLI 帮助
pnpm run cli:create   # 创建任务
pnpm run cli:list     # 列出任务
pnpm run cli:retry    # 重试任务
pnpm run cli:status   # 任务状态
pnpm run cli:result   # 任务结果
pnpm run cli:cancel   # 取消任务
pnpm run cli:workflow # 工作流管理命令

# 示例运行
pnpm run example:ts   # 运行 TypeScript 示例
pnpm run example:js   # 运行 JavaScript 示例
pnpm run example:py   # 运行 Python 示例

# 工具
pnpm run verify-env   # 验证环境配置

🏗️ 实施路线图

项目分为 4 个阶段渐进式开发,所有阶段已归档到 docs/archive/phases/

阶段 0:环境准备与项目初始化 ✅

  • 安装依赖和工具
  • 配置 TypeScript
  • 验证所有服务连接

阶段 1:核心数据层与基础架构 ✅

  • 领域模型定义
  • 数据库迁移
  • Repository 实现
  • 数据访问测试

阶段 2:LangGraph 工作流与服务集成 ✅

  • LLM Service 实现
  • LangGraph 工作流
  • 同步执行器
  • CLI 接口

阶段 3:异步任务与 Worker 系统 ✅

  • BullMQ 任务队列
  • TaskWorker 实现
  • TaskScheduler 实现
  • Bull Board 监控面板

阶段 4:质量检查与监控优化 ✅

  • 质量检查服务
  • 监控与日志
  • 性能优化
  • 安全加固

阶段 5:工作流扩展架构 ✅

  • 多工作流架构设计
  • WorkflowRegistry 实现
  • 翻译工作流支持
  • 插件化架构
  • 向后兼容性保障

详细开发历史:查看 docs/archive/phases/


📊 技术栈

| 类别 | 技术 | |------|------| | 运行时 | Node.js 18+ | | 语言 | TypeScript 5.0+ | | 工作流引擎 | LangGraph | | 数据库 | PostgreSQL 14+ | | 缓存/队列 | Redis 7+ + Bull | | LLM | DeepSeek API | | 图片生成 | Doubao API | | 测试 | Vitest | | 日志 | Winston | | 监控 | Sentry + Prometheus |


🎯 设计目标

功能目标

  • 支持内容类型:技术文章、博客文章、营销文案(可扩展)
  • 核心能力:选题搜索、内容生成、质量检查、配图生成
  • 执行模式:同步(立即返回结果)、异步(后台处理)

性能目标

  • 单任务端到端延迟:< 5 分钟
  • 支持并发用户数:100 人同时在线
  • 支持并发任务数:20 个任务同时执行(峰值)
  • 日任务处理能力:500-3000 个任务/天

可用性目标

  • 系统可用性:99.9%(每月停机时间 < 43 分钟)
  • Worker 故障自动恢复
  • 数据库主从复制,故障自动切换

🔒 安全设计

  • ✅ API Key 加密存储(AWS KMS)
  • ✅ 环境变量隔离
  • ✅ 内容审核集成(阿里云/腾讯云)
  • ✅ Token 监控与预算告警
  • ✅ 速率限制(防止滥用)

📈 监控与可观测性

  • 日志:Winston 结构化日志
  • 错误追踪:Sentry 集成
  • 指标监控:Prometheus + Grafana
  • 队列监控:Bull Board UI
  • Token 监控:实时用量统计

💰 成本预估

基于设计目标的容量(3000 任务/天):

| 项目 | 月度成本 | |------|----------| | DeepSeek API(LLM) | ¥300-500 | | Doubao API(图片生成) | ¥50-100 | | 内容审核 | ¥7 | | PostgreSQL(云数据库) | ¥100-200 | | Redis(云缓存) | ¥50-100 | | 对象存储(S3/OSS) | ¥10-20 | | 监控服务(Sentry) | 免费额度 | | 总计 | ¥500-900/月 |


🤝 贡献指南

欢迎贡献!请遵循以下步骤:

  1. Fork 本仓库
  2. 创建特性分支:git checkout -b feature/your-feature
  3. 提交更改:git commit -m 'Add some feature'
  4. 推送到分支:git push origin feature/your-feature
  5. 提交 Pull Request

📝 许可证

MIT License


📞 联系方式

如有问题或建议,请提交 Issue 或 Pull Request。


最后更新:2026-01-28 当前版本:v0.2.0 项目状态:✅ 核心功能已完成,支持多工作流扩展