WeChatAssistant: A Smart Assistant Plugin System for WeChat 150

小编 ·

WeChatAssistant: A Smart Assistant Plugin System for WeChat

WeChatAssistant is a modular and extensible plugin system built on the Buer BNCR framework, providing WeChat with smart assistance features such as weather queries, AI chat, and schedule reminders. It uses a plugin-based architecture for easy extension and maintenance, supports configuration-driven workflows and hot-reload, integrates multiple AI models, and manages sensitive information through environment variables for security.

WeChatAssistant: A Smart Assistant Plugin System for WeChat

What is the WeChat Intelligent Assistant Plugin System?

The WeChat Intelligent Assistant Plugin System (WeChatAssistant) is a modular and extensible plugin system developed based on the Wujie BNCR framework, which can provide intelligent auxiliary functions for WeChat, such as weather queries, AI conversations, and schedule reminders. It adopts a plugin-based architecture for easy extension and maintenance, supports configuration-driven and hot reload, has multiple AI models built in, and manages sensitive information through environment variables to ensure security.

What is the Wujie BNCR Framework?

Wujie BNCR is a cross-platform bot framework that supports multiple platforms including WeChat, QQ, and Telegram. The WeChat Intelligent Assistant Plugin System is specifically designed for the Wujie BNCR framework and can be seamlessly integrated into the Wujie BNCR environment, providing rich functional extensions for the WeChat platform.

WeChatAssistant:微信智能助手插件系统.jpg

Features of the WeChat Intelligent Assistant Plugin System

  • Plugin-based architecture: All features are implemented through plugins for easy extension and maintenance.

  • Configuration-driven: All features are driven by configuration files, no recompilation required.

  • AI integration: Built-in support for multiple AI models, easily extensible.

  • Hot reload: Plugin code changes are automatically reloaded.

  • Security mechanism: Plugin permission isolation to prevent malicious operations.

  • Wujie BNCR compatibility: Fully compatible with the Wujie BNCR framework and can be used as a Wujie BNCR plugin.

  • Sensitive information protection: Manages sensitive information such as API keys through environment variables to avoid information leakage.

  • Permission management system: Comprehensive user permission control, distinguishing between regular users and administrators.

Architecture of the WeChat Intelligent Assistant Plugin System

  • Core module: core.js, responsible for plugin loading and message routing.

  • Plugin loader: plugin-loader.js, responsible for initializing and monitoring plugin changes.

  • Configuration manager: config-manager.js, handles sensitive information and configuration merging.

  • Permission manager: permission-manager.js, handles user permissions and command access control.

  • Configuration files: config.json (for local use, not committed), config.example.json (configuration example, without sensitive information).

  • Environment variable files: .env (for local use, not committed), .env.example (environment variable example).

  • Plugin directory: plugins/, containing various plugins such as weather plugin, AI chat plugin, morning briefing reminder plugin, etc.

  • Main entry file: 智能助手.js.

Installation Method

Prerequisites

  • Node.js (v14.0.0+)

  • npm or yarn

  • Wujie BNCR framework environment

Install as a Wujie BNCR Plugin

  1. Navigate to the Wujie BNCR plugin directory.

  2. Clone the repository.

  3. Install dependencies.

  4. Configure sensitive information, create the environment variable file and fill in the necessary API keys.

  5. Create the local configuration file and adjust non-sensitive settings as needed.

  6. Restart the BNCR framework, and the system will automatically load the plugin.

Standalone Use

  1. Clone the repository.

  2. Install dependencies.

  3. Configure the environment variables and configuration files following the steps above.

  4. Start.

Sensitive Information Management

  • Environment variables: All sensitive information such as API keys is stored in the .env file, which will not be committed to the code repository.

  • Configuration separation: Each plugin's configuration is divided into public configuration and sensitive configuration.

  • Configuration manager: Automatically loads and merges configurations from different sources.

Usage Instructions

  • General commands: e.g., /help to display help information, /plugins list to list all available plugins, etc.

  • Weather plugin: e.g., /weather city name to query real-time weather for the specified city.

  • AI chat plugin: e.g., /chat content to converse with the AI.

  • Morning briefing reminder plugin: e.g., /morning on to enable the daily morning briefing reminder.

  • Permission management commands (administrators only): e.g., /admin list to list all administrator users.

How to Develop New Plugins

  1. Create a new plugin directory under the plugins/ directory.

  2. Create an index.js file and implement the plugin interface.

  3. Add the plugin's default configuration to the config.example.json file.

  4. Update the rule markers (@rule) in 智能助手.js.

  5. Enable the plugin in the global configuration.

Github URL:https://github.com/2013888483/WeChatAssistant