diff --git a/README.md b/README.md
index e314a29f..67b4b83c 100644
--- a/README.md
+++ b/README.md
@@ -23,8 +23,8 @@
- ✅ **自主任务规划**:能够理解复杂任务并自主规划执行,持续思考和调用工具直到完成目标
- ✅ **长期记忆:** 自动将对话记忆持久化至本地文件和数据库中,包括核心记忆和日级记忆,支持关键词及向量检索
-- ✅ **技能系统:** 实现了 Skills 创建和运行的引擎,支持从 Skill Hub、GitHub 等安装技能,或通过对话创造自定义 Skills
-- ✅ **工具系统:** 内置文件读写、终端执行、浏览器操作、定时任务、消息发送等工具,Agent 自主调用以完成复杂任务
+- ✅ **技能系统:** Skills 安装和运行的引擎,支持从 Skill Hub、GitHub 等安装技能,或通过对话创造 Skills
+- ✅ **工具系统:** 内置文件读写、终端执行、浏览器操作、定时任务等工具,Agent 自主调用以完成复杂任务
- ✅ **CLI系统:** 提供终端命令和对话命令,支持进程管理、技能安装、配置修改等操作
- ✅ **多模态消息:** 支持对文本、图片、语音、文件等多类型消息进行解析、处理、生成、发送等操作
- ✅ **多模型支持:** 支持 OpenAI, Claude, Gemini, DeepSeek, MiniMax、GLM、Qwen、Kimi、Doubao 等国内外主流模型厂商
@@ -88,11 +88,17 @@
在终端执行以下命令:
+**Linux / macOS:**
```bash
bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
```
-脚本使用说明:[一键运行脚本](https://docs.cowagent.ai/guide/quick-start)。安装后也可使用 `cow start`、`cow stop` 等 [CLI 命令](https://docs.cowagent.ai/commands/index) 管理服务。
+**Windows(PowerShell):**
+```powershell
+irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex
+```
+
+脚本使用说明:[一键运行脚本](https://docs.cowagent.ai/guide/quick-start)。安装后可使用 `cow start`、`cow stop` 等 [CLI 命令](https://docs.cowagent.ai/commands/index) 管理服务。
## 一、准备
diff --git a/cli/commands/install.py b/cli/commands/install.py
index b4b6015d..a06ab18c 100644
--- a/cli/commands/install.py
+++ b/cli/commands/install.py
@@ -6,7 +6,7 @@ import subprocess
import click
-PLAYWRIGHT_VERSION = "1.49.0"
+PLAYWRIGHT_VERSION = "1.52.0"
PLAYWRIGHT_LEGACY_VERSION = "1.28.0"
GLIBC_THRESHOLD = (2, 28)
CHINA_MIRROR = "https://registry.npmmirror.com/-/binary/playwright"
@@ -102,7 +102,7 @@ def install_browser():
# Step 1: Install playwright package
click.echo(click.style("[1/3] Installing playwright Python package...", fg="yellow"))
- ret = _pip_install(f"playwright=={target_version}" if legacy_mode else f"playwright>={target_version}")
+ ret = _pip_install(f"playwright=={target_version}")
if ret != 0:
click.echo(click.style("Failed to install playwright package.", fg="red"))
raise SystemExit(1)
@@ -143,11 +143,23 @@ def install_browser():
# Use China mirror if pip is configured with a domestic index
env = os.environ.copy()
- if _is_china_network():
+ use_mirror = _is_china_network()
+ if use_mirror:
env["PLAYWRIGHT_DOWNLOAD_HOST"] = CHINA_MIRROR
click.echo(f" (using China mirror: {CHINA_MIRROR})")
ret = subprocess.call(cmd, env=env)
+
+ # Fallback: if mirror download failed, retry with official CDN
+ if ret != 0 and use_mirror:
+ click.echo(click.style(
+ " Mirror download failed, retrying with official CDN...",
+ fg="yellow",
+ ))
+ env_no_mirror = os.environ.copy()
+ env_no_mirror.pop("PLAYWRIGHT_DOWNLOAD_HOST", None)
+ ret = subprocess.call(cmd, env=env_no_mirror)
+
if ret != 0:
click.echo(click.style("Failed to install Chromium.", fg="red"))
raise SystemExit(1)
diff --git a/common/log.py b/common/log.py
index f02a365b..e0bc577c 100644
--- a/common/log.py
+++ b/common/log.py
@@ -1,5 +1,6 @@
import logging
import sys
+import io
def _reset_logger(log):
@@ -9,7 +10,10 @@ def _reset_logger(log):
del handler
log.handlers.clear()
log.propagate = False
- console_handle = logging.StreamHandler(sys.stdout)
+ stdout = sys.stdout
+ if hasattr(stdout, "buffer"):
+ stdout = io.TextIOWrapper(stdout.buffer, encoding="utf-8", errors="replace", line_buffering=True)
+ console_handle = logging.StreamHandler(stdout)
console_handle.setFormatter(
logging.Formatter(
"[%(levelname)s][%(asctime)s][%(filename)s:%(lineno)d] - %(message)s",
diff --git a/config.py b/config.py
index b6516af7..6edd9c04 100644
--- a/config.py
+++ b/config.py
@@ -408,7 +408,7 @@ def get_root():
def read_file(path):
- with open(path, mode="r", encoding="utf-8") as f:
+ with open(path, mode="r", encoding="utf-8-sig") as f:
return f.read()
diff --git a/docs/en/README.md b/docs/en/README.md
index d6bff782..9b14d9c9 100644
--- a/docs/en/README.md
+++ b/docs/en/README.md
@@ -61,10 +61,16 @@ Full changelog: [Release Notes](https://docs.cowagent.ai/en/releases/overview)
The project provides a one-click script for installation, configuration, startup, and management:
+**Linux / macOS:**
```bash
bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
```
+**Windows (PowerShell):**
+```powershell
+irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex
+```
+
After running, the Web service starts by default. Access `http://localhost:9899/chat` to chat.
Script usage: [One-click Install](https://docs.cowagent.ai/en/guide/quick-start). After installation, you can also use `cow start`, `cow stop`, and other [CLI commands](https://docs.cowagent.ai/en/commands/index) to manage the service.
diff --git a/docs/en/guide/quick-start.mdx b/docs/en/guide/quick-start.mdx
index bf788ee6..da15ac80 100644
--- a/docs/en/guide/quick-start.mdx
+++ b/docs/en/guide/quick-start.mdx
@@ -9,9 +9,18 @@ Supports Linux, macOS, and Windows. Requires Python 3.7-3.12 (3.9 recommended).
## Install Command
-```bash
-bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
-```
+
+
+ ```bash
+ bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
+ ```
+
+
+ ```powershell
+ irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex
+ ```
+
+
The script automatically performs these steps:
@@ -36,9 +45,10 @@ After installation, use the `cow` command to manage the service:
| `cow status` | Check run status |
| `cow logs` | View real-time logs |
| `cow update` | Update code and restart |
+| `cow install-browser` | Install browser tool dependencies |
See the [Commands documentation](/en/commands/index) for more details.
- If the `cow` command is not available, you can use `./run.sh ` as a fallback (e.g., `./run.sh start`, `./run.sh stop`). Both are functionally equivalent.
+ If the `cow` command is not available, you can use `./run.sh ` (Linux/macOS) or `.\scripts\run.ps1 ` (Windows) as a fallback. Both are functionally equivalent.
diff --git a/docs/en/intro/index.mdx b/docs/en/intro/index.mdx
index bc0613a3..31cc7130 100644
--- a/docs/en/intro/index.mdx
+++ b/docs/en/intro/index.mdx
@@ -46,9 +46,18 @@ CowAgent can proactively think and plan tasks, operate computers and external re
Run the following command in your terminal for one-click install, configuration, and startup:
-```bash
-bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
-```
+
+
+ ```bash
+ bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
+ ```
+
+
+ ```powershell
+ irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex
+ ```
+
+
By default, the Web service starts after running. Access `http://localhost:9899/chat` to chat in the web interface.
diff --git a/docs/guide/quick-start.mdx b/docs/guide/quick-start.mdx
index c0c6d0c0..28364f46 100644
--- a/docs/guide/quick-start.mdx
+++ b/docs/guide/quick-start.mdx
@@ -9,9 +9,18 @@ description: 使用脚本一键安装和管理 CowAgent
## 安装命令
-```bash
-bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
-```
+
+
+ ```bash
+ bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
+ ```
+
+
+ ```powershell
+ irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex
+ ```
+
+
脚本自动执行以下流程:
@@ -41,5 +50,5 @@ bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
更多命令和用法参考 [命令文档](/commands/index)。
- 如果 `cow` 命令不可用,也可以使用 `./run.sh <命令>` 作为替代(如 `./run.sh start`、`./run.sh stop`),二者功能等效。
+ 如果 `cow` 命令不可用,也可以使用 `./run.sh <命令>`(Linux/macOS)或 `.\scripts\run.ps1 <命令>`(Windows)作为替代,功能等效。
diff --git a/docs/intro/index.mdx b/docs/intro/index.mdx
index 4cb3ef62..cf67dd4b 100644
--- a/docs/intro/index.mdx
+++ b/docs/intro/index.mdx
@@ -51,9 +51,18 @@ CowAgent 支持灵活切换多种模型,能处理文本、语音、图片、
在终端执行以下命令,即可一键安装、配置、启动 CowAgent:
-```bash
-bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
-```
+
+
+ ```bash
+ bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
+ ```
+
+
+ ```powershell
+ irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex
+ ```
+
+
运行后默认会启动 Web 控制台,通过访问 `http://localhost:9899` 可以在网页端进行对话、配置、应用通道接入等操作。
diff --git a/docs/ja/README.md b/docs/ja/README.md
index f420b32e..a5b01782 100644
--- a/docs/ja/README.md
+++ b/docs/ja/README.md
@@ -61,10 +61,16 @@
本プロジェクトは、インストール・設定・起動・管理をワンクリックで行えるスクリプトを提供しています:
+**Linux / macOS:**
```bash
bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
```
+**Windows (PowerShell):**
+```powershell
+irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex
+```
+
実行後、デフォルトでWebサービスが起動します。`http://localhost:9899/chat` にアクセスしてチャットを開始できます。
スクリプトの使い方: [ワンクリックインストール](https://docs.cowagent.ai/ja/guide/quick-start)。インストール後は `cow start`、`cow stop` などの [CLI コマンド](https://docs.cowagent.ai/ja/commands/index)でサービスを管理できます。
diff --git a/docs/ja/guide/quick-start.mdx b/docs/ja/guide/quick-start.mdx
index 147170da..a1874f2b 100644
--- a/docs/ja/guide/quick-start.mdx
+++ b/docs/ja/guide/quick-start.mdx
@@ -9,9 +9,18 @@ Linux、macOS、Windowsに対応しています。Python 3.7〜3.12が必要で
## インストールコマンド
-```bash
-bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
-```
+
+
+ ```bash
+ bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
+ ```
+
+
+ ```powershell
+ irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex
+ ```
+
+
スクリプトは以下の手順を自動的に実行します:
@@ -36,9 +45,10 @@ bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
| `cow status` | 実行状態を確認 |
| `cow logs` | リアルタイムログを表示 |
| `cow update` | コードを更新して再起動 |
+| `cow install-browser` | ブラウザツールの依存をインストール |
詳細は[コマンドドキュメント](/ja/commands/index)を参照してください。
- `cow` コマンドが利用できない場合は、`./run.sh <コマンド>`(例:`./run.sh start`、`./run.sh stop`)で代替できます。機能は同等です。
+ `cow` コマンドが利用できない場合は、`./run.sh <コマンド>`(Linux/macOS)または `.\scripts\run.ps1 <コマンド>`(Windows)で代替できます。機能は同等です。
diff --git a/docs/ja/intro/index.mdx b/docs/ja/intro/index.mdx
index 14047e20..170fad52 100644
--- a/docs/ja/intro/index.mdx
+++ b/docs/ja/intro/index.mdx
@@ -46,9 +46,18 @@ CowAgent は自ら思考しタスクを計画し、コンピュータや外部
ターミナルで以下のコマンドを実行すると、ワンクリックでインストール、設定、起動ができます:
-```bash
-bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
-```
+
+
+ ```bash
+ bash <(curl -fsSL https://cdn.link-ai.tech/code/cow/run.sh)
+ ```
+
+
+ ```powershell
+ irm https://cdn.link-ai.tech/code/cow/run.ps1 | iex
+ ```
+
+
デフォルトでは実行後に Web サービスが起動します。`http://localhost:9899/chat` にアクセスして Web インターフェースでチャットできます。
diff --git a/scripts/run.ps1 b/scripts/run.ps1
index 37941a2e..aaa99a47 100644
--- a/scripts/run.ps1
+++ b/scripts/run.ps1
@@ -18,6 +18,11 @@ param(
$ErrorActionPreference = "Stop"
+# ── ensure UTF-8 console encoding on Windows ─────────────────────
+[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
+$env:PYTHONIOENCODING = "utf-8"
+chcp 65001 | Out-Null
+
# ── colours ──────────────────────────────────────────────────────
function Write-Cow { param([string]$M) Write-Host $M -ForegroundColor Green }
function Write-Warn { param([string]$M) Write-Host $M -ForegroundColor Yellow }
@@ -85,11 +90,17 @@ function Install-Project {
}
Write-Cow "Cloning CowAgent project..."
- git clone https://github.com/zhayujie/chatgpt-on-wechat.git 2>$null
- if ($LASTEXITCODE -ne 0) {
+ $prevEAP = $ErrorActionPreference; $ErrorActionPreference = "Continue"
+ git clone https://github.com/zhayujie/chatgpt-on-wechat.git 2>&1 | Out-Null
+ $cloneExit = $LASTEXITCODE
+ $ErrorActionPreference = $prevEAP
+ if ($cloneExit -ne 0) {
Write-Warn "GitHub failed, trying Gitee..."
- git clone https://gitee.com/zhayujie/chatgpt-on-wechat.git
- if ($LASTEXITCODE -ne 0) {
+ $ErrorActionPreference = "Continue"
+ git clone https://gitee.com/zhayujie/chatgpt-on-wechat.git 2>&1 | Out-Null
+ $cloneExit = $LASTEXITCODE
+ $ErrorActionPreference = $prevEAP
+ if ($cloneExit -ne 0) {
Write-Err "Clone failed. Check your network."
exit 1
}
@@ -105,20 +116,35 @@ function Install-Project {
function Install-Dependencies {
Write-Cow "Installing dependencies..."
- & $PythonCmd -m pip install --upgrade pip setuptools wheel 2>$null | Out-Null
+ $prevEAP = $ErrorActionPreference; $ErrorActionPreference = "Continue"
+ & $PythonCmd -m pip install --upgrade pip setuptools wheel 2>&1 | Out-Null
& $PythonCmd -m pip install -r "$BaseDir\requirements.txt" 2>&1 | ForEach-Object { Write-Host $_ }
- if ($LASTEXITCODE -ne 0) {
+ $pipExit = $LASTEXITCODE
+ $ErrorActionPreference = $prevEAP
+ if ($pipExit -ne 0) {
Write-Warn "Some dependencies may have issues, but continuing..."
}
Write-Cow "Registering cow CLI..."
- & $PythonCmd -m pip install -e $BaseDir 2>$null | Out-Null
+ $prevEAP = $ErrorActionPreference; $ErrorActionPreference = "Continue"
+ & $PythonCmd -m pip install -e $BaseDir 2>&1 | Out-Null
+ $ErrorActionPreference = $prevEAP
+
+ # Ensure Python Scripts dir is in PATH for this session
+ $scriptsDir = & $PythonCmd -c "import sysconfig; print(sysconfig.get_path('scripts'))" 2>$null
+ if ($scriptsDir -and (Test-Path $scriptsDir)) {
+ if ($env:PATH -notlike "*$scriptsDir*") {
+ $env:PATH = "$scriptsDir;$env:PATH"
+ }
+ }
+
$cowBin = Get-Command cow -ErrorAction SilentlyContinue
if ($cowBin) {
- Write-Cow "cow CLI registered."
+ Write-Cow "cow CLI registered: $($cowBin.Source)"
} else {
Write-Warn "cow CLI not in PATH. You can use: $PythonCmd -m cli.cli"
+ Write-Warn "To fix permanently, add Python Scripts directory to your system PATH."
}
}
@@ -302,7 +328,8 @@ function New-ConfigFile {
$config[$k] = $ChannelExtra[$k]
}
- $config | ConvertTo-Json -Depth 5 | Set-Content -Path "$BaseDir\config.json" -Encoding UTF8
+ $jsonText = $config | ConvertTo-Json -Depth 5
+ [System.IO.File]::WriteAllText("$BaseDir\config.json", $jsonText, (New-Object System.Text.UTF8Encoding $false))
Write-Cow "Configuration file created."
}
@@ -401,15 +428,24 @@ function Update-Project {
# Stop if running
$cowBin = Get-Command cow -ErrorAction SilentlyContinue
- if ($cowBin) { & cow stop 2>$null }
+ if ($cowBin) {
+ $prevEAP = $ErrorActionPreference; $ErrorActionPreference = "Continue"
+ & cow stop 2>&1 | Out-Null
+ $ErrorActionPreference = $prevEAP
+ }
if (Test-Path "$BaseDir\.git") {
Write-Cow "Pulling latest code..."
- git pull 2>$null
- if ($LASTEXITCODE -ne 0) {
+ $prevEAP = $ErrorActionPreference; $ErrorActionPreference = "Continue"
+ git pull 2>&1 | Out-Null
+ $pullExit = $LASTEXITCODE
+ $ErrorActionPreference = $prevEAP
+ if ($pullExit -ne 0) {
Write-Warn "GitHub failed, trying Gitee..."
- git remote set-url origin https://gitee.com/zhayujie/chatgpt-on-wechat.git
- git pull
+ $ErrorActionPreference = "Continue"
+ git remote set-url origin https://gitee.com/zhayujie/chatgpt-on-wechat.git 2>&1 | Out-Null
+ git pull 2>&1 | Out-Null
+ $ErrorActionPreference = $prevEAP
}
} else {
Write-Warn "Not a git repository, skipping code update."