wechat-ai 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +114 -0
- package/dist/chunk-PRU3A74K.js +774 -0
- package/dist/chunk-PRU3A74K.js.map +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +113 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +164 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/package.json +55 -0
package/README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
# wx-ai
|
|
2
|
+
|
|
3
|
+
微信 AI 机器人 — 一条命令连接微信与任意 AI 模型。
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="docs/screenshot.png" width="800" alt="wx-ai screenshot" />
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i -g wx-ai
|
|
11
|
+
wx-ai set qwen sk-xxx
|
|
12
|
+
wx-ai
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## 支持模型
|
|
16
|
+
|
|
17
|
+
| 模型 | 默认版本 | 设置 Key |
|
|
18
|
+
|------|---------|---------|
|
|
19
|
+
| 通义千问 (Qwen) | qwen-plus | `wx-ai set qwen <key>` |
|
|
20
|
+
| DeepSeek | deepseek-chat | `wx-ai set deepseek <key>` |
|
|
21
|
+
| Claude | claude-opus-4-6 (Agent) | `wx-ai set claude <key>` |
|
|
22
|
+
| GPT | gpt-4o | `wx-ai set gpt <key>` |
|
|
23
|
+
| Gemini | gemini-2.0-flash | `wx-ai set gemini <key>` |
|
|
24
|
+
| MiniMax | MiniMax-Text-01 | `wx-ai set minimax <key>` |
|
|
25
|
+
| 智谱 (GLM) | glm-4-plus | `wx-ai set zhipu <key>` |
|
|
26
|
+
|
|
27
|
+
支持任何 OpenAI 兼容 API,编辑 `~/.wai/config.json` 即可添加。
|
|
28
|
+
|
|
29
|
+
Claude 通过 [Agent SDK](https://github.com/anthropics/claude-agent-sdk-typescript) 接入,支持执行代码、读写文件、搜索网页,不只是聊天。
|
|
30
|
+
|
|
31
|
+
## 安装运行
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# 方式一:直接运行(无需安装)
|
|
35
|
+
npx wx-ai
|
|
36
|
+
|
|
37
|
+
# 方式二:全局安装
|
|
38
|
+
npm i -g wx-ai
|
|
39
|
+
|
|
40
|
+
# 方式三:克隆源码
|
|
41
|
+
git clone https://github.com/anxiong2025/wx-ai.git
|
|
42
|
+
cd wx-ai && npm install && npm run build && node dist/cli.js
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 命令
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
wx-ai # 启动(首次自动弹出二维码)
|
|
49
|
+
wx-ai set <模型> <key> # 保存 API Key
|
|
50
|
+
wx-ai use <模型> # 设置默认模型
|
|
51
|
+
wx-ai config # 查看配置(Key 已脱敏)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 微信内指令
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
/model 查看当前模型
|
|
58
|
+
/model deepseek 切换到 DeepSeek
|
|
59
|
+
/model qwen 切换到 Qwen
|
|
60
|
+
/help 显示指令列表
|
|
61
|
+
/ping 检查状态
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## 架构
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
微信 ──ilink──> wx-ai 网关 ──路由──> AI 模型
|
|
68
|
+
│ │
|
|
69
|
+
会话管理 ┌────┴────┐
|
|
70
|
+
模型路由 │ │
|
|
71
|
+
Claude Agent OpenAI 兼容
|
|
72
|
+
(工具: Bash, (Qwen, DeepSeek,
|
|
73
|
+
Read, Web) GPT, Gemini...)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 项目结构
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
src/
|
|
80
|
+
├── cli.ts 命令行入口
|
|
81
|
+
├── gateway.ts 消息路由 & 会话管理
|
|
82
|
+
├── config.ts 配置 (~/.wai/config.json)
|
|
83
|
+
├── types.ts 核心接口定义
|
|
84
|
+
├── channels/weixin.ts 微信 ilink 协议实现
|
|
85
|
+
└── providers/
|
|
86
|
+
├── claude-agent.ts Claude Agent SDK
|
|
87
|
+
└── openai-compatible.ts 通用 OpenAI 兼容
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## 微信协议
|
|
91
|
+
|
|
92
|
+
直接实现微信 ilink bot API,不依赖 OpenClaw:
|
|
93
|
+
|
|
94
|
+
- 登录:`ilink/bot/get_bot_qrcode` 扫码
|
|
95
|
+
- 收消息:`ilink/bot/getupdates` 长轮询
|
|
96
|
+
- 发消息:`ilink/bot/sendmessage`
|
|
97
|
+
- 输入状态:`ilink/bot/sendtyping`
|
|
98
|
+
|
|
99
|
+
参考:[@tencent-weixin/openclaw-weixin](https://www.npmjs.com/package/@tencent-weixin/openclaw-weixin) (MIT)
|
|
100
|
+
|
|
101
|
+
## 计划
|
|
102
|
+
|
|
103
|
+
- [x] 微信 ilink 协议
|
|
104
|
+
- [x] 多模型切换 (`/model`)
|
|
105
|
+
- [x] 输入状态提示
|
|
106
|
+
- [x] 7 个内置模型
|
|
107
|
+
- [ ] 图片/文件收发
|
|
108
|
+
- [ ] Telegram / Discord 渠道
|
|
109
|
+
- [ ] MCP 支持
|
|
110
|
+
- [ ] npm 发布
|
|
111
|
+
|
|
112
|
+
## 协议
|
|
113
|
+
|
|
114
|
+
MIT
|