Files
LangBot/docs/zh/develop/dev-config.md
T
2025-07-28 16:06:18 +08:00

58 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 开发配置
LangBot 分为前端和后端,前端使用 Next.js + shadcn 开发,后端通过 Quart(Flask 的异步版本)开发。
## 后端
代码位于 `pkg` 目录下,由根目录的 `main.py` 文件引导启动。
安装依赖,我们使用 uv 管理依赖。
```bash
pip install uv
uv sync
```
启动后端
```bash
uv run main.py
```
此时配置文件会自动生成到 `data/config.yaml` 文件中。
## 前端
代码位于 `web` 目录下,需要安装 Node.js,[pnpm](https://pnpm.io/zh/installation)。
复制 `.env.example` 到 `.env`。
- linux环境使用
```bash
cp .env.example .env
```
- windows环境使用
```bash
copy .env.example .env
```
安装依赖并启动前端
```bash
pnpm install
pnpm dev
```
:::info
本地使用`pnpm dev`启动时,会携带`.env`中的环境变量`NEXT_PUBLIC_API_BASE_URL`,该变量会自动被前端使用,以确保前端可以访问到本地启动的后端的`5300`端口。
生产环境中,前端会被预编译成静态文件,由后端提供服务,前端会自动访问同域的后端地址。
:::
## API 文档
我们在开发每个接口之前都会先在 APIFox 中编写接口文档,请查看 [API 文档](https://ok52vhsenr.apifox.cn/)。