npm package: @quec-wx-mp/api-ai
Description: 小程序插件 AI库
Latest version: 1.0.0-alpha.0

# @quec-wx-mp/api-ai

[![Version](https://img.shields.io/badge/npm-10.8.2-orange.svg)](https://www.npmjs.com/package/npm/v/10.8.2)
[![License](https://img.shields.io/npm/l/@quec-wx-mp/api-ai.svg)](https://www.npmjs.com/package/@quec-wx-mp/api-ai)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.1-blue.svg)](https://www.typescriptlang.org/)
[![WeChat MiniProgram](https://img.shields.io/badge/WeChat-MiniProgram-07C160.svg)](https://developers.weixin.qq.com/miniprogram/en/dev/)

> 🤖 **Powerful AI Integration SDK for WeChat Mini Programs**  
> Seamlessly connect your WeChat Mini Program with advanced AI capabilities including voice recognition, conversation memory, growth tracking, and intelligent interactions.

---

## ✨ Features

- **AI Conversation Core** - Advanced dialogue management with context-aware responses
- **Memory System** - Long-term conversation memory and personality-based interactions (MBTI)
- **Growth Tracking** - Baby development monitoring and task management
- **Voice Technology** - Voice print recognition, cloning, and text-to-speech
- **Content Services** - On-demand audio content and music streaming
- **Usage Management** - License tracking and quota management
- **Customization** - Configurable bot personalities, voices, and speech rates
- **Risk Warning** - Intelligent chat monitoring and safety alerts

## 📦 Installation

```bash
npm install @quec-wx-mp/api-ai
```
## 🚀 Quick Start

### 1. Prerequisites

Before integrating the AI plugin, ensure you have:

- ✅ A registered [WeChat Mini Program](https://developers.weixin.qq.com/miniprogram/en/dev/#Apply-for-an-account) account
- ✅ The Quec WeChat Plugin already integrated into your Mini Program

### 2. Configure Plugin in app.json

Add the plugin configuration to your `app.json` file:

```json
{
  "plugins": {
    "quecPlugin": {
      "version": "1.0.0",
      "provider": "wx5e9a3feb8df9122e"
    }
  }
}
```

### 3. Initialize User Domain in app.js

Configure your user domain and secret key in `app.js`:

```javascript
// Require the plugin
const plugin = requirePlugin('quecPlugin')

// Set user domain and secret
plugin.config.setUserDomain('your user domain')
plugin.config.setUserDomainSecret('your user domain secret')
```

> ⚠️ **Important**: Replace `'your-user-domain'` and `'your-secret-key'` with your actual credentials from the Quec platform.

### 4. Import and Inject AI SDK

Import the AI SDK and inject it into the plugin:

```javascript
// Import the AI SDK
import sdk from '@quec-wx-mp/api-ai'

// Require the plugin (if not already done)
const plugin = requirePlugin('quecPlugin')

// Inject the SDK into the plugin
plugin.load(sdk)

// Verify successful installation
console.log('AI SDK Version:', plugin.ai.version)
```

### 5. Verify Installation

After completing the setup, check the console output.

If you see the version number printed, the integration was successful! 🎉

> **Tips**: For detailed documentation with Installation, visit our [Wechat Plugin Documentation](https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx8b0625890b89be58).

## 🎯 Core API Usage

#### 💬 Chat Management

#### 🧠 Memory Operations

#### 👶 Baby Growth Tracking

#### 🔊 Voice Print

## 📚 API Reference

### Modules

| Module | Description | Key Methods |
|--------|-------------|-------------|
| **Buy** | Package & Order Management | `findPackageListV2`, `createContentBizOrder` |
| **Chat** | Conversation History | `deleteHistoryV2` |
| **Content** | Audio Content Services | `isShowOnDemand`, `onDemandCategory`, `onDemandTracklist` |
| **Growth Baby** | Child Development | `addBabyInfo`, `babyTaskList`, `getBabyInfo` |
| **Memory** | Conversation Memory | `findListV2`, `getSummaryV2`, `deviceResetV2` |
| **MBTI** | Personality System | `getAiMemoryUserInfo`, `memoryCompare`, `memoryRemind` |
| **Voiceprint** | Voice Recognition | `uploadFeature`, `getFeature`, `updateDeviceVoicePrint` |
| **Usage** | License & Quota | `aiChatWarnStatus`, `aiChatPage`, `findLicenseTime` |
| **Bot** | Bot Configuration | `getSpeedConfig`, `setSpeedConfig`, `findBotList` |
| **Role** | Character Settings | `promptTemplateList`, `obtainPolishPrompt`, `findBotVoice` |
| **Summary** | Daily Summaries | `querySummaryGenerate`, `summaryCommon` |

### Complete API Documentation

For detailed API documentation with all parameters and response types, visit our [API Documentation](https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx8b0625890b89be58).

## 🏗️ Architecture
```text
# @quec-wx-mp/api-ai

├── src/
│   ├── QuecPluginAI.ts     # Core AI plugin class 
│   ├── api.ts              # API endpoint definitions
│   ├── const.ts            # Constants
│   ├── index.ts            # Entry point & exports
│   ├── tools.ts            # Utility functions 
│   └── modules/            # Feature modules
│       ├── buy.ts          # Purchase & orders
│       ├── chat.ts         # Chat management
│       ├── content.ts      # Content services
│       ├── growth_baby.ts  # Baby growth tracking
│       ├── mbti.ts         # Personality system
│       ├── memory.ts       # Memory operations
│       ├── voiceprint.ts   # Voice recognition
│       ├── usage.ts        # Usage tracking
│       ├── bot.ts          # Bot configuration
│       ├── role.ts         # Character roles
│       └── summary.ts      # Summary generation
└── dist/ # Compiled output
```

## ⚙️ Configuration

### Build Commands

```bash
# Production build
npm run build

# Development build
npm run build-dev
```

## 📝 License

MIT © [Quectel](https://aiot.quectel.com/)

## 🔗 Links

- **[NPM Package](http://192.168.23.184:4873/-/web/detail/@quec-wx-mp/api-ai)**
- **[WeChat MiniProgram Docs](https://mp.weixin.qq.com/wxopen/plugindevdoc?appid=wx8b0625890b89be58)**
- **[GitHub Repository](https://moran96.github.io/web-doc-release-demo/)**
- **[Issue Tracker](https://mp.weixin.qq.com/wxopen/plugincase?action=index&appid=wx8b0625890b89be58)**

## 📮 Support

For issues and questions:
- You can leave a message on the [WeChat Official Accounts Platform](https://mp.weixin.qq.com/wxopen/plugincase?action=index&appid=wx8b0625890b89be58)
- Contact: [daney.hong@quectel.com](daney.hong@quectel.com)

---

<div align="center">

**Built with ❤️ by Quectel Clould Team**

[![Powered by WeChat](https://img.shields.io/badge/Powered_By-WeChat_MiniProgram-07C160.svg)](https://developers.weixin.qq.com/miniprogram/en/dev/)

</div>