Initial commit: WeChat bot project with AI chat, video export, and image upload scripts
This commit is contained in:
75
CLAUDE.md
Normal file
75
CLAUDE.md
Normal file
@@ -0,0 +1,75 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Project Overview
|
||||
|
||||
This is a collection of Python scripts for a WeChat (微信) bot that integrates with OpenAI-compatible APIs for AI-powered conversations with tool calling capabilities.
|
||||
|
||||
## Architecture
|
||||
|
||||
The codebase contains two main categories of scripts:
|
||||
|
||||
### 1. Chat Bot Scripts (f25904664.py, f25904704.py, f25912200.py, f25919488.py, f25919528.py, f25922064.py)
|
||||
- `send_message` class manages conversation state and OpenAI API calls
|
||||
- Uses OpenAI-compatible API at `https://token-plan-cn.xiaomimimo.com/v1` with model `mimo-v2.5-pro`
|
||||
- Implements tool calling for: weather queries (`tianqi`), web search (`sousuo`)
|
||||
- External modules: `weixin_bot`, `get_tianqi`, `cha_xianglaing`, `weixin`
|
||||
|
||||
### 2. Image Upload Scripts (f25912304.py, f25919896.py, f25920056.py)
|
||||
- Handles WeChat image sending via `WeixinBot`
|
||||
- AES-ECB encryption for file uploads
|
||||
- Upload flow: prepare → encrypt → get upload URL → upload to WeChat servers
|
||||
- Uses `ilinkai.weixin.qq.com` API endpoints
|
||||
|
||||
### 3. Video Export Module (video_cutter.py)
|
||||
- Exports video clips based on image timestamps
|
||||
- Supports multiple modes: around/after/before/total
|
||||
- Uses ffmpeg for fast video cutting (no re-encoding)
|
||||
- Saves exported videos to `./export_videos/` directory
|
||||
|
||||
## Dependencies
|
||||
|
||||
```bash
|
||||
pip install openai httpx pycryptodome prompt_toolkit requests
|
||||
```
|
||||
|
||||
### System Dependencies (for video export)
|
||||
|
||||
```bash
|
||||
# Ubuntu/Debian
|
||||
sudo apt install ffmpeg
|
||||
|
||||
# macOS
|
||||
brew install ffmpeg
|
||||
```
|
||||
|
||||
## Key External Modules (not in repo)
|
||||
|
||||
- `weixin_bot` - WeChat bot framework (provides `WeixinBot` class)
|
||||
- `get_tianqi` - Weather data retrieval (`get_tianqi_data`)
|
||||
- `cha_xianglaing` - Web search functionality (`search1`)
|
||||
- `weixin` - WeChat utilities (`weix`)
|
||||
|
||||
## Running
|
||||
|
||||
Scripts are standalone and can be run directly:
|
||||
```bash
|
||||
python f25904664.py
|
||||
```
|
||||
|
||||
### Testing Video Export
|
||||
|
||||
```bash
|
||||
# Test video cutter module
|
||||
python video_cutter.py
|
||||
|
||||
# Run full test suite
|
||||
python test_video_export.py
|
||||
```
|
||||
|
||||
## Code Notes
|
||||
|
||||
- All comments and UI strings are in Chinese
|
||||
- Files appear to be versioned snapshots with numeric suffixes (likely from a code review or commit system)
|
||||
- API keys in code are for the Xiaomi Mimo API proxy, not direct OpenAI
|
||||
Reference in New Issue
Block a user