Skip to content

Commit f2866ba

Browse files
committed
feat: add WebUI documentation page to usage section
1 parent a7558ed commit f2866ba

File tree

3 files changed

+250
-0
lines changed

3 files changed

+250
-0
lines changed

content/docs/usage/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ import { Terminal, Download, FileArchive, FileCog, Play, Bot } from "lucide-reac
2424

2525
</Callout>
2626

27+
## WebUI
28+
29+
如果你想要使用 WebUI 配置、访问、管理您的机器人,您可以直接跳转到[部署 WebUI](/docs/usage/webui)
30+
2731
## 系统要求
2832

2933
为了方便用户,我们为以下主流平台提供了预编译的二进制文件。您可以直接下载并运行,无需手动编译。

content/docs/usage/meta.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"pages": [
77
"---安装部署---",
88
"index",
9+
"webui",
910
"plugin",
1011
"config"
1112
]

content/docs/usage/webui.mdx

Lines changed: 245 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,245 @@
1+
---
2+
title: 部署 WebUI
3+
description: 通过 WebUI 部署、管理您的 sithra-rs 机器人
4+
---
5+
6+
import { Steps, Step } from "fumadocs-ui/components/steps";
7+
import { Callout } from "fumadocs-ui/components/callout";
8+
import { Files, File, Folder } from "fumadocs-ui/components/files";
9+
import { Tabs, Tab } from "fumadocs-ui/components/tabs";
10+
import { Card, Cards } from "fumadocs-ui/components/card";
11+
import { GithubInfo } from "fumadocs-ui/components/github-info";
12+
import { Terminal, Download, FileArchive, FileCog, Play, Bot, Settings, Server, Globe, KeyRound } from "lucide-react";
13+
14+
<Callout type="info" icon={<Bot />}>
15+
16+
### 欢迎使用 sithra-web!
17+
18+
sithra-web 为 sithra-rs 提供了现代化的 Web 用户界面,
19+
20+
让您可以更直观、便捷地配置、访问和管理您的机器人。
21+
22+
本篇文档将引导您在几分钟内完成 sithra-web 的下载、配置和启动。
23+
24+
</Callout>
25+
26+
## 系统要求
27+
28+
为了方便用户,我们为以下主流平台提供了预编译的二进制文件。您可以直接下载并运行,无需手动编译。
29+
30+
- [x] Linux (x86-64)
31+
- [ ] Windows (x86-64)
32+
- [ ] macOS (x86-64)
33+
- [ ] macOS (ARM64)
34+
35+
<Callout title="其他平台">
36+
37+
如果您的操作系统或 CPU 架构不在上述列表内,您需要从源代码手动编译
38+
sithra-web。请参考下文的 [从源码编译](#2-从源码编译) 部分。
39+
40+
</Callout>
41+
42+
<Callout type="info" icon={<KeyRound className="h-4 w-4" />} title="首次启动设置">
43+
44+
首次访问 WebUI 时,系统会要求您设置管理员用户名和密码,请务必妥善保管。
45+
46+
</Callout>
47+
48+
## 1. 下载与部署
49+
50+
<Steps>
51+
52+
<Step icon={<Download />} title="从 GitHub 下载">
53+
54+
前往 [GitHub Releases](https://github.com/SithraBot/sithra-rs/releases) 页面,根据您的操作系统下载最新版本的 sithra-web 压缩包。
55+
56+
</Step>
57+
58+
<Step icon={<FileArchive />} title="解压文件">
59+
60+
将下载的压缩包解压到一个您喜欢的目录。我们建议您为 sithra-web 创建一个独立的文件夹。
61+
62+
解压后,您的目录结构应该如下所示:
63+
64+
<Files>
65+
<Folder name="sithra-web" defaultOpen>
66+
<File name="sithra-web.exe" />
67+
<Folder name="web">
68+
<File name="index.html" />
69+
<File name="...others" />
70+
</Folder>
71+
<File name="config.toml" />
72+
<Folder name="config.d">
73+
</Folder>
74+
<Folder name="plugins">
75+
<File name="example" />
76+
</Folder>
77+
</Folder>
78+
</Files>
79+
</Step>
80+
<Step icon={<FileCog />} title="创建配置文件">
81+
首次运行前,请确保 `config.toml` 文件存在于 sithra-web 的运行目录中。sithra-web 依赖此文件来加载和配置插件。
82+
83+
<Callout type="warn" title="注意">
84+
85+
如果 sithra-web 在启动时没有找到 `config.toml` 文件,程序将会自动退出。
86+
87+
</Callout>
88+
89+
关于如何编写配置文件,请[参考文档:编写配置项](/docs/usage/config)
90+
91+
</Step>
92+
93+
<Step icon={<Play />} title="启动服务">
94+
95+
一切就绪!现在您可以启动 sithra-web 了。
96+
97+
<Tabs items={["Windows", "Linux/macOS"]}>
98+
99+
<Tab>
100+
101+
在终端中执行以下命令:
102+
103+
```bash
104+
.\sithra-web.exe
105+
```
106+
107+
</Tab>
108+
109+
<Tab>
110+
111+
首先,为文件添加可执行权限,然后运行它:
112+
113+
```bash
114+
chmod +x ./sithra-web
115+
./sithra-web
116+
```
117+
118+
</Tab>
119+
120+
</Tabs>
121+
122+
如果一切顺利,您将在终端看到 sithra-web 成功启动的日志信息。默认情况下,您可以访问 `http://127.0.0.1:8080` 来打开 WebUI。
123+
124+
</Step>
125+
</Steps>
126+
127+
## 服务配置
128+
129+
<div className="flex items-center gap-2 mb-4">
130+
<Settings className="w-5 h-5 text-primary" />
131+
<span className="text-lg font-medium">命令行参数与环境变量</span>
132+
</div>
133+
134+
sithra-web 提供了灵活的配置选项,您可以通过命令行参数或环境变量来调整服务行为。
135+
136+
<Callout>
137+
138+
命令行参数的优先级高于环境变量。
139+
140+
</Callout>
141+
142+
<Cards>
143+
144+
<Card title="--host" type="info" icon={<Server />}>
145+
146+
**功能**: 设置服务监听的主机地址。
147+
148+
**默认值**: `127.0.0.1`
149+
150+
**环境变量**: `SITHRA_WEB_HOST`
151+
152+
**示例**: `sithra-web --host 0.0.0.0`
153+
154+
</Card>
155+
156+
<Card title="--port" icon={<Server />}>
157+
158+
**功能**: 设置服务监听的端口。
159+
160+
**默认值**: `8080`
161+
162+
**环境变量**: `SITHRA_WEB_PORT`
163+
164+
**示例**: `sithra-web --port 8000`
165+
166+
</Card>
167+
168+
<Card title="--web-path" icon={<Globe />}>
169+
170+
**功能**: 指定 Web UI 静态资源文件的路径。
171+
172+
**默认值**: `web`
173+
174+
**环境变量**: `SITHRA_WEB_PATH`
175+
176+
**示例**: `sithra-web --web-path /opt/sithra-web/ui`
177+
178+
</Card>
179+
180+
<Card title="--api-only" icon={<Terminal />}>
181+
182+
**功能**: 仅启动后端 API 服务,不托管 Web UI。
183+
184+
**默认值**: `false`
185+
186+
**环境变量**: `SITHRA_WEB_API_ONLY`
187+
188+
**示例**: `sithra-web --api-only`
189+
190+
</Card>
191+
192+
</Cards>
193+
194+
## 2. 从源码编译
195+
196+
如果您是开发者,或者您需要在非官方支持的平台上运行 sithra-web,您可以选择从源代码进行编译。
197+
198+
<Steps>
199+
<Step>
200+
201+
### 准备 Rust 环境
202+
203+
请确保您的系统中已安装 Rust
204+
工具链。如果尚未安装,可以参考 [Rust
205+
官方文档](https://www.rust-lang.org/tools/install) 进行安装。
206+
207+
</Step>
208+
<Step>
209+
210+
### 克隆源代码
211+
212+
使用 Git 克隆 sithra-rs 的代码仓库:
213+
214+
```shell
215+
git clone https://github.com/SithraBot/sithra-rs.git
216+
cd sithra-rs
217+
```
218+
219+
</Step>
220+
<Step>
221+
222+
### 编译项目
223+
224+
在项目根目录下,执行 `cargo build` 命令并指定编译 `sithra-web`
225+
226+
```shell
227+
cargo build -p sithra-web --release
228+
```
229+
230+
编译完成后,生成的可执行文件将位于 `target/release/` 目录下。
231+
232+
</Step>
233+
</Steps>
234+
235+
## 获取帮助
236+
237+
<div className="not-prose mt-0 flex flex-col gap-4">
238+
<GithubInfo owner="SithraBot" repo="sithra-rs" />
239+
<p className="text-sm text-fd-muted-foreground">
240+
如果您在使用过程中遇到任何问题,或有任何功能建议,欢迎随时在 GitHub Issues
241+
中提出。
242+
</p>
243+
</div>
244+
245+
您也可以加入我们的 QQ 群获取帮助:[948180922](https://qm.qq.com/q/9rhbJpXBF6)

0 commit comments

Comments
 (0)