# 快速开始

从源码启动 ShiritaiBot，连接你的第一个模型。

从`0.4.0`起，ShiritaiBot提供桌面端与自部署实例两个版本。

## 桌面端部署

前往[ShiritaiBot Release](https://github.com/ShiritaiBot-Devs/ShiritaiBot/releases)页面，并下载你的对应系统的最新版安装包。下载后，执行安装包即可。

## 自部署实例

## 一键部署

ShiritaiBot提供了一键部署脚本。

Windows:

```powershell
git clone https://github.com/ShiritaiBot-Devs/ShiritaiBot.git
cd ShiritaiBot
.\scripts\install.ps1

```

MacOS/Linux：

```bash
git clone https://github.com/ShiritaiBot-Devs/ShiritaiBot.git
cd ShiritaiBot
./scripts/install.sh
```

## 手动安装：准备环境

在 Linux、macOS 或 Windows 上准备以下工具：

* [Python 3.12+](https://www.python.org/downloads/)
* [uv](https://docs.astral.sh/uv/getting-started/installation/)，用于安装依赖和运行服务
* [Node.js 20.19+](https://nodejs.org/en/download) 与 npm，用于构建管理后台
* [Git](https://git-scm.com/downloads)

## 获取并启动

打开终端，在你想存放项目的目录执行。以下命令可用于 Bash、zsh 和 PowerShell。

```bash
git clone https://github.com/ShiritaiBot-Devs/ShiritaiBot.git
cd ShiritaiBot
uv sync
npm --prefix web ci
npm --prefix web run build
uv run shiritaibot run
```

> 如果你希望将WebUI暴露至公网，请在 `uv run` 命令后加 `--allowed-host <域名>` 参数，例如
>
> ```bash
> uv run shiritaibot run --allowed-host shiritai.example.com
> ```

启动后，打开 [http://127.0.0.1:8765](http://127.0.0.1:8765/) 进入管理后台。

## 登录管理后台

如果你采用终端启动，直接进入终端中显示的管理后台地址即可。如果你访问的是`http://127.0.0.1:8765`，或希望在异地访问ShiritaiBot，你需要输入ShiritaiBot生成的令牌。

新建终端并执行：

```bash Terminal
uv run shiritaibot token
```

将输出的令牌粘贴到登录页即可。如果忘记了token，也可以重新在新终端进入并执行。

## 接下来

沿着你需要的方向继续：

* [配置模型与路由](https://shiritaibot.dev/docs/models)
* [连接 QQ / NapCat](https://shiritaibot.dev/docs/onebot)
* [连接飞书 / Lark](https://shiritaibot.dev/docs/feishu)
* [了解主动性与工具](https://shiritaibot.dev/docs/agent-loop)
* [编写第一个插件](https://shiritaibot.dev/docs/plugins)
