AI Coach messages bookmarking. Top bar refined.
This commit is contained in:
@@ -333,23 +333,30 @@ Comprehensive test plan for the GymFlow web application, covering authentication
|
||||
**Expected Results:**
|
||||
- All exercises are created successfully with their respective types.
|
||||
|
||||
#### 2.14. A. Workout Plans - Create Plan with AI
|
||||
#### 2.14. A. Workout Plans - Create Plan with AI (Parametrized)
|
||||
|
||||
**File:** `tests/workout-management.spec.ts`
|
||||
**File:** `tests/ai-plan-creation.spec.ts`
|
||||
|
||||
**Steps:**
|
||||
1. Log in as a regular user.
|
||||
2. Navigate to the 'Plans' section.
|
||||
3. Click the '+' FAB button.
|
||||
4. Select 'With AI' option.
|
||||
5. In the AI Side Sheet, enter a prompt (e.g., 'Create a short leg workout with lunges').
|
||||
6. Click 'Generate'.
|
||||
7. Wait for the AI response.
|
||||
5. **Verify Defaults**: Duration 60, Equipment 'No equipment', Level 'Intermediate', Intensity 'Moderate'.
|
||||
6. **Modify Inputs**:
|
||||
- Set Duration to 45 mins.
|
||||
- Set Equipment to 'Free weights'.
|
||||
- Set Level to 'Advanced'.
|
||||
7. Click 'Generate' (mocks AI response).
|
||||
8. **Iterative Flow**:
|
||||
- Verify preview table appears.
|
||||
- Click 'Generate' again.
|
||||
- Click 'Save Plan'.
|
||||
|
||||
**Expected Results:**
|
||||
- A new plan is created and appears in the plans list.
|
||||
- If 'Lunges' did not exist in the user's exercise library, it is created automatically.
|
||||
- The plan contains the exercises described in the prompt.
|
||||
- A new plan is created with the AI-suggested content.
|
||||
- The plan appears in the plans list.
|
||||
- New exercises are created with correct `type` and `isUnilateral` flags.
|
||||
|
||||
#### 2.15. B. Tracker - Empty State AI Prompt
|
||||
|
||||
@@ -1075,3 +1082,57 @@ Comprehensive test plan for the GymFlow web application, covering authentication
|
||||
|
||||
**Expected Results:**
|
||||
- The volume, set count, and body weight charts resize and re-render correctly, maintaining readability and data integrity across different screen sizes.
|
||||
|
||||
### 7. VII. AI Coach Features
|
||||
|
||||
**Seed:** `tests/ai-coach.spec.ts`
|
||||
|
||||
#### 7.1. A. AI Coach - Basic Conversation & Markdown
|
||||
**File:** `tests/ai-coach.spec.ts`
|
||||
|
||||
**Steps:**
|
||||
1. Log in as a regular user.
|
||||
2. Navigate to 'AI Coach'.
|
||||
3. Type a message (e.g., "How to do a pushup?").
|
||||
4. Click 'Send'.
|
||||
5. Verify response appears.
|
||||
|
||||
**Expected Results:**
|
||||
- AI responds with a message.
|
||||
- Response renders Markdown correctly (e.g., bullet points, bold text).
|
||||
|
||||
#### 7.2. A. AI Coach - Bookmark Message
|
||||
**File:** `tests/ai-coach.spec.ts`
|
||||
|
||||
**Steps:**
|
||||
1. Send a message to AI Coach and receive a response.
|
||||
2. Click the 'Bookmark' icon on the AI's response.
|
||||
3. Verify a success notification (Snackbar).
|
||||
4. Reload the page.
|
||||
|
||||
**Expected Results:**
|
||||
- The message remains bookmarked (icon state persists).
|
||||
|
||||
#### 7.3. A. AI Coach - View Saved Messages
|
||||
**File:** `tests/ai-coach.spec.ts`
|
||||
|
||||
**Steps:**
|
||||
1. Bookmark at least one message.
|
||||
2. Click the 'Saved Messages' icon in the top bar.
|
||||
3. Verify the Saved Messages sheet opens.
|
||||
|
||||
**Expected Results:**
|
||||
- The sheet displays the bookmarked message content.
|
||||
- The content is rendered in Markdown.
|
||||
|
||||
#### 7.4. A. AI Coach - Delete Bookmark
|
||||
**File:** `tests/ai-coach.spec.ts`
|
||||
|
||||
**Steps:**
|
||||
1. Open Saved Messages sheet.
|
||||
2. Click 'Delete' (trash icon) on a saved message.
|
||||
3. Confirm if necessary (or verify immediate deletion).
|
||||
|
||||
**Expected Results:**
|
||||
- The message is removed from the list.
|
||||
- The bookmark icon in the main chat (if message is visible) updates to unbookmarked state.
|
||||
|
||||
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user