diff --git a/README.md b/README.md
index af1dd65e..cc9de579 100644
--- a/README.md
+++ b/README.md
@@ -66,6 +66,8 @@
# 🏷 更新日志
+>**2026.03.22:** [2.0.4版本](https://github.com/zhayujie/chatgpt-on-wechat/releases/tag/2.0.4),新增个人微信通道(微信扫码即用)、新增 MiniMax-M2.7 和 GLM-5-Turbo 模型、run.sh 脚本重构、日文文档及多项修复。
+
>**2026.03.18:** [2.0.3版本](https://github.com/zhayujie/chatgpt-on-wechat/releases/tag/2.0.3),新增企微智能机器人和 QQ 通道、支持Coding Plan、新增多个模型、Web端文件处理、记忆系统升级。
>**2026.02.27:** [2.0.2版本](https://github.com/zhayujie/chatgpt-on-wechat/releases/tag/2.0.2),Web 控制台全面升级(流式对话、模型/技能/记忆/通道/定时任务/日志管理)、支持多通道同时运行、会话持久化存储、新增多个模型。
@@ -74,10 +76,6 @@
>**2026.02.03:** [2.0.0版本](https://github.com/zhayujie/chatgpt-on-wechat/releases/tag/2.0.0),正式升级为超级Agent助理,支持多轮任务决策、具备长期记忆、实现多种系统工具、支持Skills框架,新增多种模型并优化了接入渠道。
->**2025.05.23:** [1.7.6版本](https://github.com/zhayujie/chatgpt-on-wechat/releases/tag/1.7.6) 优化web网页channel、新增 [AgentMesh](https://github.com/zhayujie/chatgpt-on-wechat/blob/master/plugins/agent/README.md)多智能体插件、百度语音合成优化、企微应用`access_token`获取优化、支持`claude-4-sonnet`和`claude-4-opus`模型
-
->**2025.04.11:** [1.7.5版本](https://github.com/zhayujie/chatgpt-on-wechat/releases/tag/1.7.5) 新增支持 [wechatferry](https://github.com/zhayujie/chatgpt-on-wechat/pull/2562) 协议、新增 deepseek 模型、新增支持腾讯云语音能力、新增支持 ModelScope 和 Gitee-AI API接口
-
更多更新历史请查看: [更新日志](https://docs.cowagent.ai/releases)
diff --git a/channel/web/static/js/console.js b/channel/web/static/js/console.js
index 0e147d69..b5070c28 100644
--- a/channel/web/static/js/console.js
+++ b/channel/web/static/js/console.js
@@ -5,7 +5,7 @@
// =====================================================================
// Version — update this before each release
// =====================================================================
-const APP_VERSION = 'v2.0.3';
+const APP_VERSION = 'v2.0.4';
// =====================================================================
// i18n
@@ -1810,6 +1810,9 @@ function openAddChannelPanel() {
const activeNames = new Set(channelsData.filter(c => c.active).map(c => c.name));
const available = channelsData.filter(c => !activeNames.has(c.name));
+ const content = document.getElementById('channels-content');
+ if (activeNames.size === 0 && content) content.classList.add('hidden');
+
if (available.length === 0) {
panel.innerHTML = `
${currentLang === 'zh' ? '所有通道均已接入' : 'All channels are already connected'}
@@ -1870,6 +1873,8 @@ function closeAddChannelPanel() { panel.classList.add('hidden'); panel.innerHTML = ''; } + const content = document.getElementById('channels-content'); + if (content) content.classList.remove('hidden'); } function onAddChannelSelect(chName) { diff --git a/channel/weixin/weixin_channel.py b/channel/weixin/weixin_channel.py index 03da3a7d..b40692c0 100644 --- a/channel/weixin/weixin_channel.py +++ b/channel/weixin/weixin_channel.py @@ -30,6 +30,7 @@ MAX_CONSECUTIVE_FAILURES = 3 BACKOFF_DELAY = 30 RETRY_DELAY = 2 SESSION_EXPIRED_ERRCODE = -14 +TEXT_CHUNK_LIMIT = 4000 def _load_credentials(cred_path: str) -> dict: @@ -462,11 +463,43 @@ class WeixinChannel(ChatChannel): return self._context_tokens.get(receiver, "") def _send_text(self, text: str, receiver: str, context_token: str): - try: - self.api.send_text(receiver, text, context_token) - logger.debug(f"[Weixin] Text sent to {receiver}, len={len(text)}") - except Exception as e: - logger.error(f"[Weixin] Failed to send text: {e}") + if len(text) <= TEXT_CHUNK_LIMIT: + try: + self.api.send_text(receiver, text, context_token) + logger.debug(f"[Weixin] Text sent to {receiver}, len={len(text)}") + except Exception as e: + logger.error(f"[Weixin] Failed to send text: {e}") + return + + chunks = self._split_text(text, TEXT_CHUNK_LIMIT) + for i, chunk in enumerate(chunks): + try: + self.api.send_text(receiver, chunk, context_token) + logger.debug(f"[Weixin] Text chunk {i+1}/{len(chunks)} sent to {receiver}, len={len(chunk)}") + except Exception as e: + logger.error(f"[Weixin] Failed to send text chunk {i+1}/{len(chunks)}: {e}") + break + if i < len(chunks) - 1: + time.sleep(0.5) + + @staticmethod + def _split_text(text: str, limit: int) -> list: + """Split text into chunks, preferring to break at paragraph or line boundaries.""" + if len(text) <= limit: + return [text] + chunks = [] + while text: + if len(text) <= limit: + chunks.append(text) + break + cut = text.rfind("\n\n", 0, limit) + if cut <= 0: + cut = text.rfind("\n", 0, limit) + if cut <= 0: + cut = limit + chunks.append(text[:cut]) + text = text[cut:].lstrip("\n") + return chunks def _send_image(self, img_path_or_url: str, receiver: str, context_token: str): local_path = self._resolve_media_path(img_path_or_url) diff --git a/docs/channels/weixin.mdx b/docs/channels/weixin.mdx index 11be7470..c3319930 100644 --- a/docs/channels/weixin.mdx +++ b/docs/channels/weixin.mdx @@ -11,6 +11,8 @@ description: 将 CowAgent 接入个人微信 启动 Cow 项目后打开 Web 控制台 (本地链接为: http://127.0.0.1:9899/ ),选择 **通道** 菜单,点击 **接入通道**,选择 **微信**,点击接入后按照提示扫码登录。 +
+
### 方式二:配置文件接入
在 `config.json` 中设置 `channel_type` 为 `weixin`:
@@ -23,17 +25,23 @@ description: 将 CowAgent 接入个人微信
启动程序后,终端会显示二维码,使用微信扫码授权即可完成登录。
+
+
+
-| 参数 | 说明 | 默认值 |
-| --- | --- | --- |
-| `channel_type` | 设为 `weixin` 或 `wx` | — |
-登录凭证会自动保存至 `~/.weixin_cow_credentials.json`,如需重新登录删除该文件后重启即可。
## 三、登录说明
@@ -63,10 +71,4 @@ description: 将 CowAgent 接入个人微信
| 图片消息 | ✅ 收发 |
| 文件消息 | ✅ 收发 |
| 视频消息 | ✅ 收发 |
-| 语音消息 | ✅ 接收 |
-
-## 五、注意事项
-
-1. 需确保网络可以访问 `ilinkai.weixin.qq.com`。
-2. 媒体文件(图片、文件、视频)通过 CDN 传输,使用 AES-128-ECB 加密,上传和下载由程序自动完成。
-3. 建议在稳定的网络环境下运行,避免频繁断线导致需要重新扫码。
+| 语音消息 | ✅ 接收 (自带语音识别) |
diff --git a/docs/docs.json b/docs/docs.json
index 1ef728b4..9dcc9053 100644
--- a/docs/docs.json
+++ b/docs/docs.json
@@ -174,6 +174,7 @@
"group": "发布记录",
"pages": [
"releases/overview",
+ "releases/v2.0.4",
"releases/v2.0.3",
"releases/v2.0.2",
"releases/v2.0.1",
@@ -321,6 +322,7 @@
"group": "Release Notes",
"pages": [
"en/releases/overview",
+ "en/releases/v2.0.4",
"en/releases/v2.0.2",
"en/releases/v2.0.1",
"en/releases/v2.0.0"
@@ -469,6 +471,7 @@
"group": "リリースノート",
"pages": [
"ja/releases/overview",
+ "ja/releases/v2.0.4",
"ja/releases/v2.0.3",
"ja/releases/v2.0.2",
"ja/releases/v2.0.1",
diff --git a/docs/en/releases/overview.mdx b/docs/en/releases/overview.mdx
index 38445fd4..83b3e908 100644
--- a/docs/en/releases/overview.mdx
+++ b/docs/en/releases/overview.mdx
@@ -5,6 +5,7 @@ description: CowAgent version history
| Version | Date | Description |
| --- | --- | --- |
+| [2.0.4](/en/releases/v2.0.4) | 2026.03.22 | Personal WeChat channel, new model support, Japanese docs, script refactoring and bug fixes |
| [2.0.2](/en/releases/v2.0.2) | 2026.02.27 | Web Console upgrade, multi-channel concurrency, session persistence |
| [2.0.1](/en/releases/v2.0.1) | 2026.02.27 | Built-in Web Search tool, smart context management, multiple fixes |
| [2.0.0](/en/releases/v2.0.0) | 2026.02.03 | Full upgrade to AI super assistant |
diff --git a/docs/en/releases/v2.0.4.mdx b/docs/en/releases/v2.0.4.mdx
new file mode 100644
index 00000000..a5bed23a
--- /dev/null
+++ b/docs/en/releases/v2.0.4.mdx
@@ -0,0 +1,55 @@
+---
+title: v2.0.4
+description: CowAgent 2.0.4 - Personal WeChat channel, new model support, Japanese docs, script refactoring and bug fixes
+---
+
+## 🔌 Personal WeChat Channel
+
+Added personal WeChat (`weixin`) channel — the most important update in this release. Simply scan a QR code to connect CowAgent to your personal WeChat account, with support for:
+
+- **Messaging**: Send and receive text, image, file, and video messages; receive voice messages
+- **QR Code Login**: QR code displayed in terminal, scan with WeChat to log in; auto-refresh on expiry
+- **Credential Persistence**: Login credentials saved to `~/.weixin_cow_credentials.json` automatically, no re-scan needed on restart
+- **Session Auto-Reconnect**: Automatically clears expired credentials and re-initiates QR code login
+- **Web Console Integration**: Add WeChat channel from the Web Console with synchronized QR code login flow
+- **Docker & Script Support**: Both `run.sh` and `docker-compose.yml` now support the WeChat channel
+
+Documentation: [WeChat Channel](https://docs.cowagent.ai/channels/weixin).
+
+Related commits: [ce89869](https://github.com/zhayujie/chatgpt-on-wechat/commit/ce89869), [a483ec0](https://github.com/zhayujie/chatgpt-on-wechat/commit/a483ec0), [c1421e0](https://github.com/zhayujie/chatgpt-on-wechat/commit/c1421e0)
+
+## 🤖 New Models
+
+- **MiniMax-M2.7**: Added MiniMax-M2.7 model support
+- **GLM-5-Turbo**: Added Zhipu glm-5-turbo model support
+
+Related commits: [9192f6f](https://github.com/zhayujie/chatgpt-on-wechat/commit/9192f6f)
+
+## 🔧 Script Refactoring
+
+- **run.sh Refactoring**: Extracted shared logic and eliminated duplication, reducing from 600+ lines to 177 lines ([49d8707](https://github.com/zhayujie/chatgpt-on-wechat/commit/49d8707))
+- **Executable Permission**: Fixed `run.sh` file permission issue ([652156e](https://github.com/zhayujie/chatgpt-on-wechat/commit/652156e))
+
+## ⚡ Improvements
+
+- **Unified Request Headers**: Added identification headers to external requests across Agent services (Chat, Embedding, Vision, WebSearch, etc.) ([b4e711f](https://github.com/zhayujie/chatgpt-on-wechat/commit/b4e711f))
+- **Auto-Repair Messages**: Enhanced message protocol fault tolerance with automatic repair of malformed message sequences ([b8b57e3](https://github.com/zhayujie/chatgpt-on-wechat/commit/b8b57e3))
+
+## 🌍 Japanese Documentation
+
+Added complete Japanese documentation covering getting started guide, channel integration, model configuration and other major sections. Thanks [@Ikko Ashimine](https://github.com/ikoamu)
+
+Related commits: [5487c0b](https://github.com/zhayujie/chatgpt-on-wechat/commit/5487c0b)
+
+## 🐛 Bug Fixes
+
+- **WeCom Bot Compatibility**: Fixed compatibility with older `websocket-client` versions, added unified WebSocket compatibility layer ([bc7f627](https://github.com/zhayujie/chatgpt-on-wechat/commit/bc7f627))
+- **run.sh PID**: Fixed process PID retrieval error in `run.sh` ([9febb07](https://github.com/zhayujie/chatgpt-on-wechat/commit/9febb07))
+- **Feishu Encoding**: Fixed message and log encoding issue in Feishu channel ([7d0e156](https://github.com/zhayujie/chatgpt-on-wechat/commit/7d0e156))
+- **Feishu Config**: Removed redundant `feishu_bot_name` dependency in `run.sh` ([1b5be1b](https://github.com/zhayujie/chatgpt-on-wechat/commit/1b5be1b))
+
+## 📦 Upgrade
+
+Run `./run.sh update` for a one-click upgrade, or manually pull the latest code and restart. See [Upgrade Guide](https://docs.cowagent.ai/guide/upgrade) for details.
+
+**Release Date**: 2026.03.22 | [Full Changelog](https://github.com/zhayujie/chatgpt-on-wechat/compare/2.0.3...master)
diff --git a/docs/ja/releases/overview.mdx b/docs/ja/releases/overview.mdx
index f5149908..4e6e69f5 100644
--- a/docs/ja/releases/overview.mdx
+++ b/docs/ja/releases/overview.mdx
@@ -5,7 +5,8 @@ description: CowAgent バージョン履歴
| バージョン | 日付 | 説明 |
| --- | --- | --- |
-| [2.0.2](/en/releases/v2.0.2) | 2026.02.27 | Web Console アップグレード、マルチチャネル同時実行、セッション永続化 |
+| [2.0.4](/ja/releases/v2.0.4) | 2026.03.22 | 個人WeChatチャネル追加、新モデルサポート、日本語ドキュメント、スクリプトリファクタリングおよび複数修正 |
+| [2.0.2](/ja/releases/v2.0.2) | 2026.02.27 | Web Console アップグレード、マルチチャネル同時実行、セッション永続化 |
| [2.0.1](/en/releases/v2.0.1) | 2026.02.27 | 組み込み Web Search ツール、スマートコンテキスト管理、複数の修正 |
| [2.0.0](/en/releases/v2.0.0) | 2026.02.03 | AI スーパーアシスタントへの全面アップグレード |
| 1.7.6 | 2025.05.23 | Web Channel 最適化、AgentMesh プラグイン |
diff --git a/docs/ja/releases/v2.0.4.mdx b/docs/ja/releases/v2.0.4.mdx
new file mode 100644
index 00000000..97d10d9b
--- /dev/null
+++ b/docs/ja/releases/v2.0.4.mdx
@@ -0,0 +1,55 @@
+---
+title: v2.0.4
+description: CowAgent 2.0.4 - 個人WeChat チャネルの追加、新モデルサポート、日本語ドキュメント、スクリプトリファクタリングおよび複数の修正
+---
+
+## 🔌 個人WeChat チャネルの追加
+
+個人WeChat(`weixin`)チャネルを追加しました。本バージョンの最も重要なアップデートです。QRコードをスキャンするだけで CowAgent を個人WeChatに接続でき、以下の機能をサポートします:
+
+- **メッセージ送受信**:テキスト、画像、ファイル、動画メッセージの送受信、音声メッセージの受信をサポート
+- **QRコードログイン**:ターミナルにQRコードを表示、WeChatでスキャンして確認するだけでログイン完了。QRコード期限切れ時は自動更新
+- **認証情報の永続化**:ログイン認証情報を `~/.weixin_cow_credentials.json` に自動保存、再起動時に再スキャン不要
+- **Session 自動再接続**:Session 期限切れ時に旧認証情報を自動クリアし、QRコードログインを再開
+- **Web コンソール接続**:Web コンソールからWeChatチャネルを追加可能、QRコードログインフローを同期表示
+- **Docker・スクリプト対応**:`run.sh` と `docker-compose.yml` がWeChat チャネルに対応
+
+接続ドキュメント:[WeChat 接続](https://docs.cowagent.ai/channels/weixin)。
+
+関連コミット:[ce89869](https://github.com/zhayujie/chatgpt-on-wechat/commit/ce89869), [a483ec0](https://github.com/zhayujie/chatgpt-on-wechat/commit/a483ec0), [c1421e0](https://github.com/zhayujie/chatgpt-on-wechat/commit/c1421e0)
+
+## 🤖 新規モデル
+
+- **MiniMax-M2.7**:MiniMax-M2.7 モデルのサポートを追加
+- **GLM-5-Turbo**:智譜 glm-5-turbo モデルのサポートを追加
+
+関連コミット:[9192f6f](https://github.com/zhayujie/chatgpt-on-wechat/commit/9192f6f)
+
+## 🔧 スクリプトリファクタリング
+
+- **run.sh リファクタリング**:共通ロジックを抽出し、大量の重複コードを削除。スクリプトの行数を 600+ 行から 177 行に圧縮 ([49d8707](https://github.com/zhayujie/chatgpt-on-wechat/commit/49d8707))
+- **実行権限**:`run.sh` ファイルの権限問題を修正 ([652156e](https://github.com/zhayujie/chatgpt-on-wechat/commit/652156e))
+
+## ⚡ 最適化
+
+- **リクエストヘッダー統一**:Agent の各サービス(Chat、Embedding、Vision、WebSearch 等)の外部リクエストに統一的な識別ヘッダーを追加 ([b4e711f](https://github.com/zhayujie/chatgpt-on-wechat/commit/b4e711f))
+- **メッセージ自動修復**:メッセージプロトコルのフォールトトレランスを強化し、フォーマット異常なメッセージシーケンスを自動修復 ([b8b57e3](https://github.com/zhayujie/chatgpt-on-wechat/commit/b8b57e3))
+
+## 🌍 日本語ドキュメント
+
+完全な日本語ドキュメントを追加しました。入門ガイド、チャネル接続、モデル設定などの主要セクションをカバーしています。Thanks [@Ikko Ashimine](https://github.com/ikoamu)
+
+関連コミット:[5487c0b](https://github.com/zhayujie/chatgpt-on-wechat/commit/5487c0b)
+
+## 🐛 バグ修正
+
+- **企業微信ボット互換性**:旧バージョンの `websocket-client` との互換性問題を修正し、統一的な WebSocket 互換レイヤーを追加 ([bc7f627](https://github.com/zhayujie/chatgpt-on-wechat/commit/bc7f627))
+- **run.sh PID 取得**:`run.sh` でのプロセス PID 取得エラーを修正 ([9febb07](https://github.com/zhayujie/chatgpt-on-wechat/commit/9febb07))
+- **飛書エンコーディング**:飛書チャネルのメッセージとログのエンコーディング問題を修正 ([7d0e156](https://github.com/zhayujie/chatgpt-on-wechat/commit/7d0e156))
+- **飛書設定**:`run.sh` での `feishu_bot_name` への冗長な依存を削除 ([1b5be1b](https://github.com/zhayujie/chatgpt-on-wechat/commit/1b5be1b))
+
+## 📦 アップグレード方法
+
+ソースコードデプロイの場合は `./run.sh update` でワンクリックアップグレードできます。または手動でコードをプルして再起動してください。詳細は [アップデートドキュメント](https://docs.cowagent.ai/guide/upgrade) を参照。
+
+**リリース日**:2026.03.22 | [Full Changelog](https://github.com/zhayujie/chatgpt-on-wechat/compare/2.0.3...master)
diff --git a/docs/releases/overview.mdx b/docs/releases/overview.mdx
index f9ce9a04..fc891bff 100644
--- a/docs/releases/overview.mdx
+++ b/docs/releases/overview.mdx
@@ -5,6 +5,7 @@ description: CowAgent 版本更新历史
| 版本 | 日期 | 说明 |
| --- | --- | --- |
+| [2.0.4](/releases/v2.0.4) | 2026.03.22 | 新增个人微信通道、新模型支持、日文文档、脚本重构及多项修复 |
| [2.0.3](/releases/v2.0.3) | 2026.03.18 | 新增企微智能机器人和 QQ 通道、支持Coding Plan、新增多个模型、Web端文件处理、记忆系统升级 |
| [2.0.2](/releases/v2.0.2) | 2026.02.27 | Web 控制台升级、多通道同时运行、会话持久化 |
| [2.0.1](/releases/v2.0.1) | 2026.02.13 | 内置 Web Search 工具、智能上下文管理、多项修复 |
diff --git a/docs/releases/v2.0.4.mdx b/docs/releases/v2.0.4.mdx
new file mode 100644
index 00000000..447f7992
--- /dev/null
+++ b/docs/releases/v2.0.4.mdx
@@ -0,0 +1,51 @@
+---
+title: v2.0.4
+description: CowAgent 2.0.4 - 新增个人微信通道、新模型支持、日文文档、脚本重构及多项修复
+---
+
+## 🔌 新增个人微信通道
+
+新增个人微信(`weixin`)通道,微信扫描二维码即可将 CowAgent 接入个人微信,支持以下功能:
+
+- **消息收发**:支持文本、图片、文件、视频消息的接收与回复,支持语音消息接收和识别
+- **扫码登录**:终端显示二维码,微信扫码确认即可登录,二维码过期自动刷新
+- **凭证持久化**:登录凭证自动保存至 `~/.weixin_cow_credentials.json`,重启无需重新扫码
+- **Session 自动重连**:Session 过期后自动清除旧凭证并重新发起扫码登录
+- **Web 控制台接入**:支持在 Web 控制台中添加微信通道,扫码登录流程同步展示
+- **Docker 和脚本支持**:`run.sh` 和 `docker-compose.yml` 均已适配微信通道
+
+接入文档:[微信接入](https://docs.cowagent.ai/channels/weixin)。
+
+相关提交:[ce89869](https://github.com/zhayujie/chatgpt-on-wechat/commit/ce89869)
+
+## 🤖 新增模型
+
+- **MiniMax-M2.7**:新增 MiniMax-M2.7 模型支持
+- **GLM-5-Turbo**:新增智谱 glm-5-turbo 模型支持
+
+相关提交:[9192f6f](https://github.com/zhayujie/chatgpt-on-wechat/commit/9192f6f)
+
+## 🔧 脚本重构
+
+- **run.sh 重构**:提取公共逻辑,精简脚本代码([49d8707](https://github.com/zhayujie/chatgpt-on-wechat/commit/49d8707))
+- **可执行权限**:修复 `run.sh` 文件权限问题 ([652156e](https://github.com/zhayujie/chatgpt-on-wechat/commit/652156e))
+- **PID 获取**:修复 `run.sh` 中进程 PID 获取错误的问题 ([9febb07](https://github.com/zhayujie/chatgpt-on-wechat/commit/9febb07))
+
+## 🌍 文档更新
+
+新增完整的日文文档,覆盖入门指南、通道接入、模型配置等主要章节。Thanks [@Ikko Ashimine](https://github.com/ikoamu)
+
+相关提交:[5487c0b](https://github.com/zhayujie/chatgpt-on-wechat/commit/5487c0b)
+
+## 🐛 问题修复
+
+- **企微机器人兼容**:修复旧版 `websocket-client` 的兼容性问题,新增统一的 WebSocket 兼容层 ([bc7f627](https://github.com/zhayujie/chatgpt-on-wechat/commit/bc7f627))
+- **消息自动修复**:增强消息协议的容错能力,自动修复格式异常的消息序列 ([b8b57e3](https://github.com/zhayujie/chatgpt-on-wechat/commit/b8b57e3))
+- **飞书编码**:修复飞书通道消息和日志的编码问题 ([7d0e156](https://github.com/zhayujie/chatgpt-on-wechat/commit/7d0e156))
+- **飞书配置**:移除 `run.sh` 中对 `feishu_bot_name` 的冗余依赖 ([1b5be1b](https://github.com/zhayujie/chatgpt-on-wechat/commit/1b5be1b))
+
+## 📦 升级方式
+
+源码部署可执行 `./run.sh update` 一键升级,或手动拉取代码后重启。详见 [更新升级文档](https://docs.cowagent.ai/guide/upgrade)。
+
+**发布日期**:2026.03.22 | [Full Changelog](https://github.com/zhayujie/chatgpt-on-wechat/compare/2.0.3...master)