setup-ai-tutor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSet 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 .envCreates your local environment configuration from the example template.
bash
cp .env.example .env从示例模板创建本地环境配置。
2. Install Dependencies
2. 安装依赖项
bash
uv syncInstalls all Python packages defined in pyproject.toml.
bash
uv sync安装pyproject.toml中定义的所有Python包。
3. Start Database
3. 启动数据库
bash
docker-compose up -d dbStarts PostgreSQL in a Docker container.
bash
docker-compose up -d db在Docker容器中启动PostgreSQL。
4. Run Database Migrations
4. 运行数据库迁移
bash
uv run alembic upgrade headApplies all pending database migrations.
bash
uv run alembic upgrade head应用所有待处理的数据库迁移。
5. Start Development Server
5. 启动开发服务器
bash
uv run uvicorn app.main:app --reload --port 8123Starts 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
undefinedTest API health
Test API health
curl -s http://localhost:8123/health
curl -s http://localhost:8123/health
Test database connection
Test database connection
curl -s http://localhost:8123/health/db
Both should return `{"status":"healthy"}` responses.curl -s http://localhost:8123/health/db
两者都应返回`{"status":"healthy"}`响应。Output
输出
A running local AI Tutor instance.
一个运行中的本地AI Tutor实例。
Access Points
访问地址
- Swagger UI: http://localhost:8123/docs
- Health Check: http://localhost:8123/health
- Database: localhost (Docker container)
- Swagger UI:http://localhost:8123/docs
- 健康检查:http://localhost:8123/health
- 数据库:localhost(Docker容器)
Cleanup
清理操作
To stop services:
bash
undefined停止服务的方法:
bash
undefinedStop dev server: Ctrl+C
Stop dev server: Ctrl+C
Stop database: docker-compose down
Stop database: docker-compose down
undefinedundefinedNotes
注意事项
- Port numbers and the exact service name may differ — check
docker-compose,docker-compose.yml, and the project README for project-specific values before running..env.example
- 端口号和服务名称可能有所不同——运行前请查看
docker-compose、docker-compose.yml和项目README获取项目特定配置。.env.example