Skip to content

Commit 5d36ad2

Browse files
authored
feat(install): add multilingual setup and mainland China mirrors (#10629)
* feat(install): add multilingual setup and mainland China mirrors * fix(install): support PowerShell 5.1 and Invoke-Expression * fix(install): support BOM-free PowerShell pipeline execution * fix(install): configure UTF-8 console output * fix(install): set Windows console code page internally * fix(install): keep IEX bootstrap menu ASCII-only * fix(install): default language selection to English * test(install): cover language source defaults * fix(test): escape PowerShell assertion patterns * fix(install): restore localized language menu * fix(install): list English as first language * fix(install): put English first in language prompt * feat(install): add indented AstrBot installer header * fix(install): apply indentation consistently * feat(install): show AstrBot startup commands * docs(install): clarify AstrBot startup steps * feat(install): fall back from Python mirror * fix(install): keep Windows setup in one console * ci: run install tests in fixed shells * fix(install): tolerate a removed current directory * docs: simplify script deployment instructions * fix(install): align Bash wizard with PowerShell flow * fix(install): refresh shell before manual startup * docs: rename deployment sidebar entries * fix: restore PowerShell 5.1 installer compatibility * test: isolate reboot thread mock from asyncio executor * test: shorten long prompt IDs for Windows * fix: keep completed traces closed when update timestamps collide
1 parent fc6b326 commit 5d36ad2

16 files changed

Lines changed: 1613 additions & 101 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Test install scripts
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'docs/public/install.ps1'
9+
- 'docs/public/install.sh'
10+
- 'tests/test_install_script.py'
11+
- 'tests/install_script.Tests.ps1'
12+
- '.github/workflows/install_script_test.yml'
13+
pull_request:
14+
paths:
15+
- 'docs/public/install.ps1'
16+
- 'docs/public/install.sh'
17+
- 'tests/test_install_script.py'
18+
- 'tests/install_script.Tests.ps1'
19+
- '.github/workflows/install_script_test.yml'
20+
workflow_dispatch:
21+
22+
jobs:
23+
test:
24+
name: Windows PowerShell compatibility
25+
runs-on: windows-latest
26+
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v7
30+
31+
- name: Test Windows PowerShell 5.1
32+
shell: powershell
33+
run: .\tests\install_script.Tests.ps1
34+
35+
- name: Test PowerShell 7
36+
shell: pwsh
37+
run: .\tests\install_script.Tests.ps1
38+
39+
shell:
40+
name: Bash installer (${{ matrix.os }})
41+
strategy:
42+
matrix:
43+
os: [ubuntu-latest, macos-latest]
44+
runs-on: ${{ matrix.os }}
45+
46+
steps:
47+
- name: Checkout
48+
uses: actions/checkout@v7
49+
50+
- name: Test Bash installer
51+
shell: bash
52+
run: |
53+
/bin/bash -n docs/public/install.sh
54+
python3 tests/test_install_script.py

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Visit [AstrBot Launcher](https://github.com/Raven95676/astrbot-launcher) to down
102102

103103
**More deployment methods**
104104

105-
If you need panel-based management or deeper customization, see [BT-Panel Deployment](https://docs.astrbot.app/deploy/astrbot/btpanel.html) for BT Panel app-store setup, [1Panel Deployment](https://docs.astrbot.app/deploy/astrbot/1panel.html) for 1Panel app-market deployment, [CasaOS Deployment](https://docs.astrbot.app/deploy/astrbot/casaos.html) for NAS/home-server visual deployment, and [Manual Deployment](https://docs.astrbot.app/deploy/astrbot/cli.html) for fully custom source-based installation with `uv`.
105+
If you need panel-based management or deeper customization, see [BT-Panel Deployment](https://docs.astrbot.app/deploy/astrbot/btpanel.html), [1Panel Deployment](https://docs.astrbot.app/deploy/astrbot/1panel.html), [CasaOS Deployment](https://docs.astrbot.app/deploy/astrbot/casaos.html), or [Source Deployment](https://docs.astrbot.app/deploy/astrbot/cli.html).
106106

107107

108108
## ❤️ Sponsors

‎README_zh-TW.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ uv tool upgrade astrbot --python 3.12
101101

102102
**更多部署方式**
103103

104-
若你需要面板化或更高自訂程度的部署,可參考 [寶塔面板](https://docs.astrbot.app/deploy/astrbot/btpanel.html)(BT Panel 應用商店安裝)、[1Panel](https://docs.astrbot.app/deploy/astrbot/1panel.html)(1Panel 應用商店安裝)、[CasaOS](https://docs.astrbot.app/deploy/astrbot/casaos.html)(NAS / 家用伺服器可視化部署)與 [手動部署](https://docs.astrbot.app/deploy/astrbot/cli.html)(基於原始碼與 `uv` 的完整自訂安裝)。
104+
若你需要面板化或更高自訂程度的部署,可參考 [寶塔面板](https://docs.astrbot.app/deploy/astrbot/btpanel.html)、[1Panel](https://docs.astrbot.app/deploy/astrbot/1panel.html)、[CasaOS](https://docs.astrbot.app/deploy/astrbot/casaos.html) 或 [原始碼部署](https://docs.astrbot.app/deploy/astrbot/cli.html)。
105105

106106
## ❤️ 贊助商
107107

‎README_zh.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ uv tool upgrade astrbot --python 3.12
102102

103103
**更多部署方式**
104104

105-
若你需要面板化或更高自定义部署,可参考 [宝塔面板](https://docs.astrbot.app/deploy/astrbot/btpanel.html)(BT Panel 应用商店安装)、[1Panel](https://docs.astrbot.app/deploy/astrbot/1panel.html)(1Panel 应用商店安装)、[CasaOS](https://docs.astrbot.app/deploy/astrbot/casaos.html)(NAS / 家庭服务器可视化部署)和 [手动部署](https://docs.astrbot.app/deploy/astrbot/cli.html)(基于源码与 `uv` 的完整自定义安装)。
105+
若你需要面板化或更高自定义部署,可参考 [宝塔面板](https://docs.astrbot.app/deploy/astrbot/btpanel.html)、[1Panel](https://docs.astrbot.app/deploy/astrbot/1panel.html)、[CasaOS](https://docs.astrbot.app/deploy/astrbot/casaos.html) 和 [源码部署](https://docs.astrbot.app/deploy/astrbot/cli.html)。
106106

107107
## ❤️ 赞助商
108108

‎astrbot/core/utils/trace_store.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ def _write(self, connection: sqlite3.Connection, batch: list[dict]) -> None:
257257
has_models=MAX(traces.has_models, excluded.has_models),
258258
has_plugins=MAX(traces.has_plugins, excluded.has_plugins),
259259
search=excluded.search, data=excluded.data, size_bytes=excluded.size_bytes
260-
WHERE excluded.updated_ns >= traces.updated_ns""",
260+
WHERE excluded.updated_ns >= traces.updated_ns
261+
AND (traces.state = 'running' OR excluded.state != 'running')""",
261262
(
262263
trace_id,
263264
int(summary["start_time_unix_nano"]),

‎docs/.vitepress/config.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ export default defineConfig({
4343
base: "/deploy",
4444
collapsed: false,
4545
items: [
46-
{ text: "包管理器部署", link: "/astrbot/package" },
46+
{ text: "脚本部署", link: "/astrbot/package" },
4747
{ text: "雨云一键云部署", link: "/astrbot/rainyun" },
4848
{ text: "桌面客户端部署", link: "/astrbot/desktop" },
4949
{ text: "启动器一键部署", link: "/astrbot/launcher" },
5050
{ text: "Docker 部署", link: "/astrbot/docker" },
5151
{ text: "Kubernetes 部署", link: "/astrbot/kubernetes" },
5252
{ text: "宝塔面板部署", link: "/astrbot/btpanel" },
5353
{ text: "1Panel 部署", link: "/astrbot/1panel" },
54-
{ text: "手动部署", link: "/astrbot/cli" },
54+
{ text: "源码部署", link: "/astrbot/cli" },
5555
{
5656
text: "其他部署方式",
5757
link: "/astrbot/other-deployments",
@@ -313,14 +313,14 @@ export default defineConfig({
313313
base: "/en/deploy",
314314
collapsed: false,
315315
items: [
316-
{ text: "Package Manager", link: "/astrbot/package" },
316+
{ text: "Script Deployment", link: "/astrbot/package" },
317317
{ text: "Desktop Client", link: "/astrbot/desktop" },
318318
{ text: "One-click Launcher", link: "/astrbot/launcher" },
319319
{ text: "Docker", link: "/astrbot/docker" },
320320
{ text: "Kubernetes", link: "/astrbot/kubernetes" },
321321
{ text: "BT Panel", link: "/astrbot/btpanel" },
322322
{ text: "1Panel", link: "/astrbot/1panel" },
323-
{ text: "Manual", link: "/astrbot/cli" },
323+
{ text: "Source Deployment", link: "/astrbot/cli" },
324324
{
325325
text: "Other Deployments",
326326
link: "/astrbot/other-deployments",

‎docs/en/deploy/astrbot/package.md‎

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,65 @@
1-
# Package Manager Deployment (uv)
1+
# Script Deployment
22

3-
Use `uv` to install and run AstrBot quickly.
3+
AstrBot provides installation scripts for Linux, macOS, WSL, and Windows. The scripts install `uv`, AstrBot, and Python 3.12.
44

5-
## Before You Start
5+
## Linux / macOS / WSL
66

7-
If `uv` is not installed, install it first by following the official guide:
8-
<https://docs.astral.sh/uv/>
7+
Interactive installation:
98

10-
`uv` supports Linux, Windows, and macOS.
9+
```bash
10+
curl -fsSL https://docs.astrbot.app/install.sh | bash
11+
```
12+
13+
Unattended installation:
14+
15+
```bash
16+
curl -fsSL https://docs.astrbot.app/install.sh -o install.sh
17+
bash install.sh --language en-US --download-source official --non-interactive
18+
```
19+
20+
`--download-source` accepts `china`, `official`, or `custom`. The default language is English. If the source is omitted, Chinese uses the mainland China mirrors; English and Japanese use official sources.
21+
22+
## Windows
23+
24+
Run these commands in PowerShell 5.1 or PowerShell 7+.
25+
26+
Interactive installation:
1127

12-
## Important Notes
28+
```powershell
29+
irm https://docs.astrbot.app/install.ps1 | iex
30+
```
31+
32+
Unattended installation:
33+
34+
```powershell
35+
Invoke-WebRequest https://docs.astrbot.app/install.ps1 -OutFile install.ps1 -UseBasicParsing
36+
.\install.ps1 -Language en-US -DownloadSource official -NonInteractive
37+
```
38+
39+
`-DownloadSource` accepts `china`, `official`, or `custom`. The default language is English. If the source is omitted, Chinese uses the mainland China mirrors; English and Japanese use official sources.
1340

14-
> [!WARNING]
15-
> AstrBot deployed via `uv` **does not support upgrading through the WebUI**. To update, run `uv tool upgrade astrbot --python 3.12` from the command line.
41+
The mainland China option also configures the USTC mirror for Python 3.12 and retries with the official Python source on failure. Existing Python mirror environment variables or explicit options take priority.
1642

17-
AstrBot requires Python 3.12 or later. Use `--python 3.12` to ensure that `uv` creates the tool environment with Python 3.12; if Python downloads are enabled, `uv` will download Python 3.12 automatically when it is missing.
43+
## After Installation
1844

19-
## Install and Start
45+
The installer runs `uv tool update-shell`. Reload the environment for your shell:
2046

2147
```bash
22-
uv tool install astrbot --python 3.12
23-
astrbot
48+
# Bash
49+
source ~/.bashrc
50+
# Zsh
51+
source ~/.zshrc
52+
# Fish
53+
source ~/.config/fish/config.fish
54+
# PowerShell
55+
. $PROFILE
2456
```
57+
58+
Then run these commands manually:
59+
60+
```bash
61+
astrbot init
62+
astrbot run
63+
```
64+
65+
> AstrBot installed by script does not support upgrades through the WebUI. Run `uv tool upgrade astrbot --python 3.12` to update it.

0 commit comments

Comments
 (0)