AI API
AI 功能端點 — 每日更新、計畫生成、AI 摘要。
GET /ai/daily-update
取得 AI 生成的每日訓練更新。
Headers
- `Authorization`: `Bearer <token>`
Response (200)
| 欄位 | 類型 | 說明 |
|---|---|---|
| `greeting` | string | 個人化問候 |
| `today_plan` | object | 今日訓練計畫 |
| `yesterday_review` | object | 昨日回顧 |
| `weekly_progress` | object | 本週進度 |
| `tips` | array | 建議 |
POST /ai-coach/generate-plan
使用 AI 生成訓練計畫。
Request Body
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| `target_race` | string | ✅ | 目標距離 |
| `target_time` | string | ❌ | 目標時間 |
| `weeks` | number | ✅ | 訓練週數 |
| `days_per_week` | number | ✅ | 每週訓練天數 |
| `current_fitness` | string | ❌ | 目前體能(`beginner`, `intermediate`, `advanced`) |
| `org_id` | string | ❌ | 組織 ID |
POST /ai-coach/generate-plan/stream
同上,但使用 Server-Sent Events (SSE) 串流回傳。
POST /ai-coach/generate-draft
使用 AI 生成單次課表草稿。
Request Body
| 參數 | 類型 | 必填 | 說明 |
|---|---|---|---|
| `workout_type` | string | ✅ | 課表類型 |
| `target_distance` | number | ❌ | 目標距離 |
| `athlete_id` | string | ❌ | 選手 ID(根據選手狀態調整) |
POST /ai-coach/generate-draft/stream
同上,SSE 串流版本。
GET /ai-coach/training-principle/{org_id}
取得組織的訓練原則設定。
GET /notifications/ai-summary
取得最新的 AI 訓練摘要通知。
GET /notifications/ai-summary/weekly
取得每週 AI 訓練摘要。