Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NiceKit Projects

一个由5个独立npm包组件集合而成的AI工具生态系统,专注于AI应用开发、CLI工具、MCP协议服务、Agent管理和Steam数据分析。

项目概述

NiceKit Projects 是一个模块化的AI工具生态系统,每个组件都是独立的npm包,可以单独开发、构建和发布。这种设计使得各个组件可以独立演进,同时保持整体生态的一致性。

组件架构

nicekit-projects/
├── nicekit/           # @nicekit/core - 核心AI工具库
├── nicecli/           # @nicekit/cli - CLI工具包
├── nicemcp/           # @nicekit/mcp - MCP协议服务组件
├── nice-agent/        # @nicekit/agent - AI Agent管理平台
└── nice-steam/        # @nicekit/steam - Steam数据分析组件库

组件详情

1. @nicekit/core - 核心AI工具库

路径: nicekit/

描述: 轻量级AI工具库,提供统一的提示词构建、多模型传输和响应解析能力。

核心特性:

  • 🚀 统一客户端 - 一个 AIClient 替代庞大的服务单例,支持 Gemini / OpenAI / Anthropic 三种协议
  • 📝 提示词构建器 - 链式 API 构建提示词,告别手动字符串拼接
  • 📋 模板注册表 - 领域化提示词模板管理,支持版本控制和条件渲染
  • 🔄 响应解析 - 安全的 JSON 提取、验证和降级策略
  • ⚛️ React Hooks - useGenerate / useGenerateStream 封装状态管理
  • 🌍 领域模板 - 内置健康、玄学等领域提示词模板

安装:

npm install @nicekit/core

2. @nicekit/cli - CLI工具包

路径: nicecli/

描述: CLI工具包 — 命令解析器、会话管理器、MCP客户端、AI对话集成。

核心特性:

  • 🎯 命令解析器 - 支持多种命令格式解析
  • 💬 会话管理 - 完整的会话状态管理
  • 🔌 MCP客户端 - 与MCP协议服务无缝集成
  • 🤖 AI对话集成 - 流式AI对话支持

安装:

npm install @nicekit/cli @nicekit/core

3. @nicekit/mcp - MCP协议服务组件

路径: nicemcp/

描述: 基于MCP协议的领域服务组件,调用nicekit能力为Agent提供各领域服务。

核心特性:

  • 🏦 财富运势服务 - 每日运势、投资建议、财务规划
  • 💪 健康分析服务 - 健康数据分析、BMI计算、运动计划
  • 📊 数据分析服务 - 数据统计、相关性分析、可视化建议
  • 🔧 工具服务 - 文本处理、格式转换、编码解码

安装:

npm install @nicekit/mcp

4. @nicekit/agent - AI Agent管理平台

路径: nice-agent/

描述: Nice Today App的AI Agent管理平台,基于FastAPI + PydanticAI + React构建。

核心特性:

  • 🎯 Agent管理 - 多Agent创建、配置和管理
  • 🔧 工具注册 - 动态工具注册和调用
  • 📊 可观测性 - 全链路追踪和监控
  • 🚀 容器化部署 - Docker + Nginx完整部署方案

技术栈:

  • 后端: FastAPI + PydanticAI + Python 3.11
  • 前端: React 19 + Vite + Tailwind CSS
  • 数据层: SQLite + Redis
  • 部署: Docker Compose + Nginx

5. @nicekit/steam - Steam数据分析组件库

路径: nice-steam/

描述: Steam数据分析与游戏库组件库,三端融合,SQLite持久化。

核心特性:

  • 🎮 游戏库管理 - Steam游戏数据导入和管理
  • 📊 数据分析 - 游戏统计、价格对比、个性化推荐
  • 📱 三端融合 - Web、桌面端(Tauri)、移动端(Capacitor)
  • 🎨 主题系统 - Steam风格UI组件和主题

技术栈:

  • 前端: React 19 + TypeScript + Tailwind CSS
  • 状态管理: Zustand
  • 数据库: sql.js (SQLite WebAssembly)
  • 桌面端: Tauri
  • 移动端: Capacitor

开发指南

1. 克隆项目

git clone https://github.com/SmallRob/nicekit-projects.git
cd nicekit-projects

2. 安装依赖

每个组件都是独立的npm包,需要分别安装依赖:

# 核心库
cd nicekit && npm install

# CLI工具
cd ../nicecli && npm install

# MCP服务
cd ../nicemcp && npm install

# Agent平台
cd ../nice-agent && npm install

# Steam组件
cd ../nice-steam && npm install

3. 开发模式

# 核心库开发
cd nicekit && npm run dev

# CLI工具开发
cd ../nicecli && npm run dev

# MCP服务开发
cd ../nicemcp && npm run dev

# Agent平台开发
cd ../nice-agent && npm run dev

# Steam组件开发
cd ../nice-steam && npm run dev

4. 构建

# 构建核心库
cd nicekit && npm run build

# 构建CLI工具
cd ../nicecli && npm run build

# 构建MCP服务
cd ../nicemcp && npm run build

# 构建Agent平台
cd ../nice-agent && npm run build

# 构建Steam组件
cd ../nice-steam && npm run build

组件依赖关系

@nicekit/core (核心库)
    ↓
@nicekit/cli (CLI工具) ← 依赖 @nicekit/core
    ↓
@nicekit/mcp (MCP服务) ← 依赖 @nicekit/cli
    ↓
@nicekit/agent (Agent平台) ← 依赖 @nicekit/core
    ↓
@nicekit/steam (Steam组件) ← 依赖 @nicekit/core

快速开始示例

使用核心库

import { AIClient, PromptBuilder, extractJson } from '@nicekit/core';

// 初始化客户端
const client = new AIClient({
  models: [{
    id: 'deepseek',
    name: 'DeepSeek',
    API_KEY: 'your-api-key',
    ServiceEndPoint: 'https://api.deepseek.com/v1/chat/completions',
    deploymentName: 'deepseek-chat',
  }],
  defaultModelId: 'deepseek',
});

// 构建提示词
const { systemInstruction, userPrompt } = new PromptBuilder()
  .systemInstruction('你是一位专业的健康顾问')
  .prompt('请给出今日养生建议')
  .constrain('字数100字以内')
  .outputFormat({ kind: 'json', schemaHint: '{"tips":["..."]}' })
  .build();

// 调用AI
const text = await client.generate(userPrompt, { systemInstruction });
const data = extractJson<{ tips: string[] }>(text);

使用CLI工具

import { AIClient, AIClientAdapter, sendAiMessage } from '@nicekit/cli';

const client = new AIClient({
  models: [{ id: 'deepseek-chat', provider: 'deepseek', apiKey: '...' }],
  defaultModelId: 'deepseek-chat',
});

const aiAdapter = new AIClientAdapter(client);
const response = await sendAiMessage(aiAdapter, '你好', history, onChunk);

使用MCP服务

import { NiceMcpService, FortuneService } from '@nicekit/mcp';

const mcpService = new NiceMcpService({
  port: 3000,
  logging: { level: 'info', console: true }
});

const nicekit = mcpService.getNiceKit();
mcpService.registerService('fortune', new FortuneService(nicekit));
await mcpService.start();

项目文档

每个组件都有详细的文档:

贡献指南

  1. Fork 项目
  2. 创建功能分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 创建 Pull Request

许可证

MIT License - 详见各个组件的LICENSE文件

联系方式

About

由多个独立npm包组件集合而成的AI工具生态系统,专注于AI应用开发、CLI工具、MCP协议服务、Agent管理和Steam数据分析。

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages