aiwechat-vercel  by pwh-pwh

WeChat bot on Vercel Functions

Created 1 year ago
805 stars

Top 43.9% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a serverless solution to integrate AI capabilities into WeChat Official Accounts using Vercel Functions. It targets developers and users looking for a low-cost, easy-to-deploy method to add advanced AI features like conversational bots to their WeChat presence without managing traditional servers.

How It Works

The solution leverages Vercel's serverless functions to handle incoming WeChat messages and interact with various AI models. It utilizes Redis for state management, enabling features like continuous conversation history. The architecture is designed for minimal cost and operational overhead, relying on Vercel's infrastructure and a user-provided domain.

Quick Start & Requirements

  • Install: Fork the GitHub project and deploy to Vercel.
  • Prerequisites: A Vercel account, a domain name, and a WeChat Official Account. A Vercel Redis database instance is required for conversation history.
  • Configuration: Set environment variables including GPT_TOKEN, WX_TOKEN, botType (e.g., gpt, spark, qwen, gemini), and optionally GPT_URL, gptModel, maxOutput. Connect the Vercel Redis instance to the project.
  • Setup: Configure DNS CNAME records for your domain to point to Vercel and update WeChat Official Account server settings.
  • Docs: bilibili video tutorial, discussions

Highlighted Details

  • Supports multiple AI models: GPT, Spark, Qwen, Gemini, and DeepSeek.
  • Enables continuous conversation history via Redis integration.
  • Includes command-based control for switching bots, managing prompts, and clearing history.
  • Offers a test endpoint (/api/check) and a chat test endpoint (/api/chat).
  • Supports image-to-URL functionality.

Maintenance & Community

The project welcomes contributions via Pull Requests and Issues. Discussions are available on GitHub.

Licensing & Compatibility

The repository does not explicitly state a license in the README. Users should verify licensing for commercial use or integration with closed-source applications.

Limitations & Caveats

Vercel's free tier has a 10-second function timeout, which may affect responses to long AI queries. WeChat's message length limit of 500+ characters can also cause response failures, though this can be mitigated by setting maxOutput. Vercel's default domain is blocked in China, necessitating a custom domain.

Health Check
Last Commit

6 days ago

Responsiveness

1 day

Pull Requests (30d)
5
Issues (30d)
16
Star History
6 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.