setup-ai-tutor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Set Up the AI Tutor Locally

在本地搭建AI Tutor

Run the following commands to set up and start the AI Tutor locally.
运行以下命令在本地搭建并启动AI Tutor。

Input

输入

None required. Run from the repository root.
无需输入。请在仓库根目录下运行命令。

Process

操作流程

1. Create Environment File

1. 创建环境文件

bash
cp .env.example .env
Creates your local environment configuration from the example template.
bash
cp .env.example .env
从示例模板创建本地环境配置。

2. Install Dependencies

2. 安装依赖项

bash
uv sync
Installs all Python packages defined in pyproject.toml.
bash
uv sync
安装pyproject.toml中定义的所有Python包。

3. Start Database

3. 启动数据库

bash
docker-compose up -d db
Starts PostgreSQL in a Docker container.
bash
docker-compose up -d db
在Docker容器中启动PostgreSQL。

4. Run Database Migrations

4. 运行数据库迁移

bash
uv run alembic upgrade head
Applies all pending database migrations.
bash
uv run alembic upgrade head
应用所有待处理的数据库迁移。

5. Start Development Server

5. 启动开发服务器

bash
uv run uvicorn app.main:app --reload --port 8123
Starts the FastAPI server with hot-reload on port 8123.
bash
uv run uvicorn app.main:app --reload --port 8123
在8123端口启动带有热重载功能的FastAPI服务器。

6. Validate Setup

6. 验证搭建结果

Check that everything is working:
bash
undefined
检查所有服务是否正常运行:
bash
undefined

Test API health

Test API health

Test database connection

Test database connection


Both should return `{"status":"healthy"}` responses.

两者都应返回`{"status":"healthy"}`响应。

Output

输出

A running local AI Tutor instance.
一个运行中的本地AI Tutor实例。

Access Points

访问地址

Cleanup

清理操作

To stop services:
bash
undefined
停止服务的方法:
bash
undefined

Stop dev server: Ctrl+C

Stop dev server: Ctrl+C

Stop database: docker-compose down

Stop database: docker-compose down

undefined
undefined

Notes

注意事项

  • Port numbers and the exact
    docker-compose
    service name may differ — check
    docker-compose.yml
    ,
    .env.example
    , and the project README for project-specific values before running.
  • 端口号和
    docker-compose
    服务名称可能有所不同——运行前请查看
    docker-compose.yml
    .env.example
    和项目README获取项目特定配置。