Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix: official web

Pancake3fab7154b0a3
diff --git a/README.md b/README.md
index ec7e9d163..2c467ba5c 100644
--- a/README.md
+++ b/README.md
@@ -318,85 +318,23 @@ cp .env.example .env
### Step 2: Choose Your Installation Method
-<table>
-<tr>
-<td width="50%" valign="top">
+#### 🐳 Option A: Docker Deployment
-<h3 align="center">🐳 Docker Deployment</h3>
-<p align="center"><b>Recommended</b> — No Python/Node.js setup</p>
-
----
+> No Python/Node.js setup required
**Prerequisites**: [Docker](https://docs.docker.com/get-docker/) & [Docker Compose](https://docs.docker.com/compose/install/)
-<details open>
-<summary><b>🔨 Option A: Build from Source</b></summary>
+**Quick Start** — Build from source:
```bash
-# Build and start (~5-10 min first run)
-docker compose up --build -d
-
-# View logs
-docker compose logs -f
+docker compose up --build -d # Build and start (~5-10 min first run)
+docker compose logs -f # View logs
```
-</details>
-
-<details>
-<summary><b>🚀 Option B: Pre-built Image (Fastest)</b></summary>
-
-**Choose the right image for your architecture:**
-
-| Architecture | Image Tag | Use Case |
-|:-------------|:----------|:---------|
-| **AMD64** | `ghcr.io/hkuds/deeptutor:latest` | Intel/AMD processors (most cloud servers, Windows/Linux PCs) |
-| **ARM64** | `ghcr.io/hkuds/deeptutor:latest-arm64` | Apple Silicon (M1/M2/M3/M4), ARM servers (AWS Graviton, Raspberry Pi) |
+**Or use pre-built image** (faster):
```bash
-# For AMD64 (Intel/AMD) - Linux/macOS
-docker run -d --name deeptutor \
- -p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-api-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
- -v $(pwd)/data:/app/data \
- -v $(pwd)/config:/app/config:ro \
- ghcr.io/hkuds/deeptutor:latest
-
-# For ARM64 (Apple Silicon M1/M2/M3/M4, ARM servers)
-docker run -d --name deeptutor \
- -p 8001:8001 -p 3782:3782 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- -e LLM_HOST=https://api.openai.com/v1 \
- -e EMBEDDING_MODEL=text-embedding-3-large \
- -e EMBEDDING_API_KEY=your-api-key \
- -e EMBEDDING_HOST=https://api.openai.com/v1 \
- -v $(pwd)/data:/app/data \
- -v $(pwd)/config:/app/config:ro \
- ghcr.io/hkuds/deeptutor:latest-arm64
-
-# Windows PowerShell: use ${PWD} instead of $(pwd)
-docker run -d --name deeptutor `
- -p 8001:8001 -p 3782:3782 `
- -e LLM_MODEL=gpt-4o `
- -e LLM_API_KEY=your-api-key `
- -e LLM_HOST=https://api.openai.com/v1 `
- -e EMBEDDING_MODEL=text-embedding-3-large `
- -e EMBEDDING_API_KEY=your-api-key `
- -e EMBEDDING_HOST=https://api.openai.com/v1 `
- -v ${PWD}/data:/app/data `
- -v ${PWD}/config:/app/config:ro `
- ghcr.io/hkuds/deeptutor:latest
-```
-
-Or use with `.env` file:
-
-```bash
-# AMD64
+# Linux/macOS (AMD64)
docker run -d --name deeptutor \
-p 8001:8001 -p 3782:3782 \
--env-file .env \
@@ -404,118 +342,115 @@ docker run -d --name deeptutor \
-v $(pwd)/config:/app/config:ro \
ghcr.io/hkuds/deeptutor:latest
-# ARM64 (Apple Silicon, ARM servers)
-docker run -d --name deeptutor \
- -p 8001:8001 -p 3782:3782 \
- --env-file .env \
- -v $(pwd)/data:/app/data \
- -v $(pwd)/config:/app/config:ro \
- ghcr.io/hkuds/deeptutor:latest-arm64
+# Apple Silicon (ARM64): use ghcr.io/hkuds/deeptutor:latest-arm64
+# Windows PowerShell: use ${PWD} instead of $(pwd)
```
-> 💡 **Tip**: Not sure which architecture? Run `uname -m` in terminal. `x86_64` = AMD64, `arm64`/`aarch64` = ARM64
-
-</details>
-
-**Commands**:
+**Common Commands**:
```bash
docker compose up -d # Start
-docker compose logs -f # Logs
docker compose down # Stop
-docker compose up --build # Rebuild
-
-# Update image (choose your architecture)
-docker pull ghcr.io/hkuds/deeptutor:latest # AMD64
-docker pull ghcr.io/hkuds/deeptutor:latest-arm64 # ARM64
+docker compose logs -f # View logs
+docker compose up --build # Rebuild after changes
```
-> **Dev Mode**: Add `-f docker-compose.dev.yml`
-
<details>
-<summary><b>☁️ Cloud Deployment Configuration</b></summary>
+<summary>📋 <b>More Docker Options</b> (Pre-built images, Cloud deployment, Custom ports)</summary>
+
+**Pre-built Image Architecture Reference:**
+
+| Architecture | Image Tag | Use Case |
+|:-------------|:----------|:---------|
+| **AMD64** | `ghcr.io/hkuds/deeptutor:latest` | Intel/AMD (most servers, Windows/Linux PCs) |
+| **ARM64** | `ghcr.io/hkuds/deeptutor:latest-arm64` | Apple Silicon, AWS Graviton, Raspberry Pi |
-For cloud/remote server deployment, you **must** configure the external API URL so the browser can connect to your backend:
+> 💡 Run `uname -m` to check: `x86_64` = AMD64, `arm64`/`aarch64` = ARM64
+
+**Cloud Deployment** — Must set external API URL:
```bash
-# Set NEXT_PUBLIC_API_BASE_EXTERNAL to your server's public URL
docker run -d --name deeptutor \
-p 8001:8001 -p 3782:3782 \
-e NEXT_PUBLIC_API_BASE_EXTERNAL=https://your-server.com:8001 \
- -e LLM_MODEL=gpt-4o \
- -e LLM_API_KEY=your-api-key \
- ... other env vars ...
+ --env-file .env \
+ -v $(pwd)/data:/app/data \
ghcr.io/hkuds/deeptutor:latest
```
-Or in `.env` file:
-```bash
-NEXT_PUBLIC_API_BASE_EXTERNAL=https://your-server.com:8001
-```
-
**Custom Ports Example:**
+
```bash
-# Using port 9001 for backend and 3000 for frontend
docker run -d --name deeptutor \
-p 9001:9001 -p 3000:3000 \
-e BACKEND_PORT=9001 \
-e FRONTEND_PORT=3000 \
-e NEXT_PUBLIC_API_BASE_EXTERNAL=https://your-server.com:9001 \
- ... other env vars ...
+ --env-file .env \
+ -v $(pwd)/data:/app/data \
ghcr.io/hkuds/deeptutor:latest
```
-> ⚠️ **Important**: Without `NEXT_PUBLIC_API_BASE_EXTERNAL`, the frontend defaults to `localhost:8001`, which only works for local development.
-
</details>
-</td>
-<td width="50%" valign="top">
+---
-<h3 align="center">💻 Manual Installation</h3>
-<p align="center">For development or non-Docker environments</p>
+#### 💻 Option B: Manual Installation
----
+> For development or non-Docker environments
**Prerequisites**: Python 3.10+, Node.js 18+
-**Set Up Environment**:
+**1. Set Up Environment**:
```bash
# Using conda (Recommended)
-conda create -n deeptutor python=3.10
-conda activate deeptutor
+conda create -n deeptutor python=3.10 && conda activate deeptutor
# Or using venv
-python -m venv venv
-source venv/bin/activate
+python -m venv venv && source venv/bin/activate # Windows: venv\Scripts\activate
```
-**Install Dependencies**:
+**2. Install Dependencies**:
```bash
-bash scripts/install_all.sh
-
-# Or manually:
pip install -r requirements.txt
npm install --prefix web
```
-**Launch**:
+**3. Launch**:
```bash
-# Start web interface
-python scripts/start_web.py
+python scripts/start_web.py # Start frontend + backend
+# Or: python scripts/start.py # CLI only
+# Stop: Ctrl+C
+```
-# Or CLI only
-python scripts/start.py
+<details>
+<summary>🔧 <b>Start Frontend & Backend Separately</b></summary>
-# Stop: Ctrl+C
+**Backend** (FastAPI):
+```bash
+python src/api/run_server.py
+# Or: uvicorn src.api.main:app --host 0.0.0.0 --port 8001 --reload
```
-</td>
-</tr>
-</table>
+**Frontend** (Next.js):
+```bash
+cd web && npm install && npm run dev -- -p 3782
+```
+
+**Note**: Create `web/.env.local`:
+```
+NEXT_PUBLIC_API_BASE=http://localhost:8001
+```
+
+| Service | Default Port |
+|:---:|:---:|
+| Backend | `8001` |
+| Frontend | `3782` |
+
+</details>
### Access URLs
diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts
index ded8c15c5..79603ad77 100644
--- a/docs/.vitepress/config.mts
+++ b/docs/.vitepress/config.mts
@@ -11,6 +11,11 @@ export default defineConfig({
['link', { rel: 'icon', href: '/DeepTutor/logo.png' }]
],
+ // 忽略 localhost 链接检查(这些是示例地址,构建时不可访问)
+ ignoreDeadLinks: [
+ /^http:\/\/localhost/
+ ],
+
// 国际化配置
locales: {
root: {
diff --git a/web/.env.local b/web/.env.local
index 8840a64d6..0b6543af3 100644
--- a/web/.env.local
+++ b/web/.env.local
@@ -3,7 +3,7 @@
# ============================================
# This file is automatically updated based on config/main.yaml
# and environment variables (NEXT_PUBLIC_API_BASE, NEXT_PUBLIC_API_BASE_EXTERNAL)
-#
+#
# To configure for remote access, set in your .env file:
# NEXT_PUBLIC_API_BASE=http://your-server-ip:8001
# ============================================