AI Coach messages bookmarking. Top bar refined.

This commit is contained in:
AG
2025-12-16 16:41:50 +02:00
parent cb0bd1a55d
commit dd027e1615
26 changed files with 2496 additions and 270 deletions

View File

@@ -68,18 +68,21 @@ Users can structure their training via Plans.
* **Trigger**: "Create with AI" option in Plans FAB Menu, or "Ask your AI coach" link from Tracker (when no plans exist).
* **UI Flow**:
* Opens a dedicated Side Sheet in the Plans view.
* User enters a text prompt describing desired workout (e.g., "Create a 20-minute HIIT workout").
* "Generate" button initiates AI call.
* **Inputs**:
* **Duration**: Slider (5 min to 2+ hours, 5 min step). Default 60 min.
* **Equipment**: Selector (No equipment, Essentials, Free weights, Complete gym). Default "No equipment".
* **Level**: Selector (Beginner, Intermediate, Advanced). Default "Intermediate".
* **Intensity**: Selector (Low, Moderate, High). Default "Moderate".
* **Additional Constraints**: Textarea (optional).
* **Action**: "Generate" button initiates AI call.
* **Preview**: Displays generated plan table. User can "Generate" again to retry, or "Save Plan" to finalize.
* **AI Logic**:
* System sends prompt to AI service (`geminiService`).
* AI returns a structured JSON object containing: `name`, `description`, and `exercises` array.
* Each exercise object contains: `name`, `isWeighted` (boolean), `restTimeSeconds` (number).
* For **new exercises** (not in user's library), AI also provides: `type` ('reps' or 'time'), `unilateral` (boolean).
* **Auto-Creation of Exercises**:
* System parses AI response.
* For each exercise in the response, checks if it exists in the user's exercise library by name.
* If not found, creates a new `Exercise` record with AI-provided attributes (type, unilateral flag) via `saveExercise`.
* Links the new/existing exercise ID to the plan step.
* System sends structured prompt to AI service (`geminiService`) embedding all parameters.
* **Naming Rules**:
* Exercise names must NOT contain "Weighted" (use `isWeighted` flag).
* Exclude variants (e.g. "or ...") and form notes.
* **Structure**: Each item in list = ONE set.
* AI returns JSON with `name`, `description`, `exercises` (with `type`, `unilateral` for new ones).
* **Result**: Saves the generated `WorkoutPlan` to DB and displays it in the Plans list.
### 3.3. Exercise Library
@@ -196,6 +199,15 @@ Accessible only if `User.role === 'ADMIN'`.
* **Delete User**: Permanent removal.
* **Reset Password**: Admin can manually trigger password reset flows.
### 3.8. AI Coach
- **Conversational Interface**: Chat-like interface for asking fitness-related questions.
- **Context Awareness**: Access to user's workout history and profile for personalized advice.
- **RAG Integration**: Retrieval Augmented Generation using recent workout logs.
- **Plan Generation**: Ability to generate structured workout plans based on user prompt.
- **Markdown Support**: Rich text formatting for AI responses (bold, lists, code blocks).
- **Bookmarking**: Users can save helpful AI messages for later reference.
- **History Persistence**: Chat history is preserved locally across reloads.
## 4. Technical Constants & Constraints
* **Database**: SQLite (via Prisma).
* **API Schema**: REST-like (JSON).