wechat-chatGPT  by gtoxlili

ChatGPT bot for WeChat public accounts

created 2 years ago
383 stars

Top 75.7% on sourcepulse

GitHubView on GitHub
Project Summary

This project provides a ChatGPT bot for WeChat Official Accounts, enabling passive replies to user messages. It targets developers and users looking to integrate ChatGPT's conversational AI into their WeChat presence, offering a bridge between the popular messaging platform and OpenAI's powerful language model.

How It Works

The bot leverages Go for its backend and interacts with the ChatGPT API. A key component is its method for obtaining and maintaining cf_clearance and session-token cookies, crucial for bypassing Cloudflare's security measures when accessing chat.openai.com. It uses Playwright for browser automation to acquire these credentials, which are then stored in config.json for subsequent API calls.

Quick Start & Requirements

  • Install: Compile the project using go build -trimpath -o ./dist/weChatGPT -ldflags "-X 'main.wxToken=$(Token)' -w -s -buildid=".
  • Prerequisites:
    • Go compiler
    • cf-clearance Python package (pip install --upgrade cf-clearance)
    • Playwright (playwright install)
    • System dependencies for Playwright (e.g., libatk1.0-0, libcups2, libpango-1.0-0, libcairo2).
    • xvfb for headless browser operations.
  • Setup: Requires obtaining cf_clearance and session-token via a provided Python script, then configuring config.json. A reverse proxy (Nginx/Caddy) is needed for deployment.
  • Docs: vvanglro/cf-clearance

Highlighted Details

  • Bypasses Cloudflare protection using cf_clearance and session-token.
  • Utilizes Playwright for automated browser interaction to fetch necessary cookies.
  • Attempts to mitigate WeChat Official Account's 5-second response time limit, extending it to 15 seconds.

Maintenance & Community

  • The project appears to be a personal endeavor with no explicit mention of maintainers, community channels, or a roadmap.

Licensing & Compatibility

  • The README does not specify a license.

Limitations & Caveats

The project explicitly states it is "almost impossible to work normally" due to ChatGPT API response times frequently exceeding the 15-second limit imposed by WeChat Official Accounts. The author suggests a potential refactor once an official ChatGPT API is released. The cf_clearance acquisition requires matching the User-Agent and IP address between acquisition and runtime.

Health Check
Last commit

2 years ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
0 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.