- Make Routine.steps optional in types.ts — list endpoint does not
eager-load steps, so the field is absent from the JSON response
- Guard routine.steps?.length ?? 0 in routines list page to prevent
SSR TypeError when steps is undefined
- Move redirect() outside try/catch in suggest save action; SvelteKit
redirect throws internally and was being caught, causing a 500 error
instead of navigating to the new routine
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add Gemini-powered endpoints and frontend pages for proposing skincare
routines based on skin state, product compatibility, grooming schedule,
and recent history.
Backend (routines.py):
- POST /routines/suggest — single AM/PM routine for a date
- POST /routines/suggest-batch — AM+PM plan for up to 14 days
- Prompt context: skin snapshot, grooming schedule, 7-day history,
filtered product list with effects/incompatibilities/context rules
- Respects retinoid frequency limits, acid/retinoid separation,
grooming-aware safe_after_shaving rules
Frontend:
- /routines/suggest page with tab switcher (single / batch)
- Single tab: date + AM/PM + optional notes → generate → preview → save
- Batch tab: date range + notes → collapsible day cards (AM+PM) → save all
- Loading spinner during Gemini calls; product names resolved from map
- "Zaproponuj rutynę AI" button added to routines list page
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- New route /routines/grooming-schedule with load + create/update/delete actions
- Entries grouped by day of week with inline editing
- 4 API functions added to api.ts (get/create/update/delete)
- Nav: add Grooming link, fix isActive to not highlight parent when child matches
- Nav: replace ⌂ text char with 🏠 emoji for Dashboard
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace category filter dropdown with client-side grouping and a
3-way ownership toggle (All / Owned / Not owned). Products are grouped
by category with header rows as visual dividers, sorted brand → name
within each group. Category column removed (redundant with headings).
Backend: GET /products now returns ProductWithInventory so inventory
data is available for ownership filtering (bulk-loaded in one query).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Remove s.trend from dashboard (field removed from SkinConditionSnapshot)
- Replace trend with texture in SkinPhotoAnalysisResponse (api.ts)
- Use record_id instead of id for LabResult and MedicationEntry keyed each blocks
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the derived `trend` field (better computed from history by the MCP
agent) and add `texture: smooth|rough|flaky|bumpy` which LLM can reliably
assess from photos. Updates model, API, system prompt, tests, and frontend.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the All/AM/PM filter buttons and part_of_day param from
the routines list page — date-based sorting/filtering is preferred.
Add missing keyed {#each} blocks across all pages to follow
Svelte 5 best practice (dashboard, products, medications,
lab results, routines list and detail, skin).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add POST /skincare/analyze-photos endpoint that accepts 1–3 skin
photos, sends them to Gemini vision, and returns a structured
SkinPhotoAnalysisResponse for pre-filling the snapshot form.
Extract shared Gemini client setup into innercontext/llm.py
(get_gemini_client) so both products and skincare use a single
default model (gemini-flash-latest) and API key check.
Frontend: AI photo card on /skin page with file picker, previews,
and auto-fill of all form fields from the analysis result.
New fields (skin_type, sebum_tzone, sebum_cheeks) added to form
and server action.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previously redirected to /products/{id} (edit page) which looks
identical to the create form, making it appear as if nothing happened.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add POST /products/parse-text endpoint that accepts raw product text,
calls Gemini (google-genai) with a structured extraction prompt, and
returns a partial ProductParseResponse. Frontend gains a collapsible
"AI pre-fill" card at the top of ProductForm that merges the LLM
response into all form fields reactively.
- Backend: ProductParseRequest/Response schemas, system prompt with
enum constraints, temperature=0.0 for deterministic extraction,
effect_profile always returned in full
- Frontend: parseProductText() in api.ts; controlled $state bindings
for all text/number/checkbox inputs; applyAiResult() merges response
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wrap all prop-derived $state initializers with untrack() to explicitly
signal that one-time capture from the product prop is intentional.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds full_weight_g and empty_weight_g to ProductBase (inherited by Product
and response models) so per-product package weight specs are captured.
Adds last_weighed_at to ProductInventory to record when a package was last
weighed. Wires up all fields through API schemas, frontend types, forms, and
the product detail page (add/edit/display).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Classification: replace fragmented layout (full-width + 3-col + full-width)
with a single 2-column grid; Category spans full width via col-span-2
- Effect profile: replace flex + fixed w-40 label with CSS grid using
minmax(7rem,10rem) label column to prevent overflow at narrow viewports
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Extract shared ProductForm.svelte component covering actives (dynamic
rows with ingredient function checkboxes), product_effect_profile
(range sliders 0–5), context_rules (tristate selects), synergizes_with,
incompatible_with (dynamic rows), and contraindications.
Replace the Quick edit stub on the product detail page with the full
edit form pre-populated from the existing product. Update both server
actions to parse all new fields including JSON payloads for complex
nested objects.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Drop Product.personal_rating from model, API schemas, and all frontend
views (list table, detail view, quick-edit form, new-product form)
- Extract get_or_404 into backend/innercontext/api/utils.py; remove five
duplicate copies from individual API modules
- Fix all ty type errors: generic get_or_404 with TypeVar, cast() in
coerce_effect_profile validator, col() for ilike on SQLModel column,
dict[str, Any] annotation in test helper, ty: ignore for CORSMiddleware
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
shadcn-svelte components import these types from \$lib/utils — add
re-exports from bits-ui to resolve 25 type errors.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Drop fields identified as redundant or low-value from the Product model,
API schemas, frontend types, and forms. Raise effect_profile threshold in
to_llm_context() from >0 to >=2 to suppress noise values. Remove sku/barcode
from LLM context output (kept on model for catalog use).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename skincare route prefix /skin-snapshots → /skincare to match API client
- Add redirect_slashes=False to FastAPI app; change collection routes from "/" to ""
to eliminate 307 redirects on POST/GET without trailing slash
- Fix redirect() inside try/catch in products/new and routines/new server actions
(SvelteKit redirect() throws and was being caught as a 500 error)
- Eagerly load inventory and steps relationships via explicit SELECT + model_dump(mode="json"),
working around SQLModel 0.0.37 not serializing Relationship fields in response_model
- Add field_validator for product_effect_profile to coerce DB-returned dict → ProductEffectProfile,
eliminating Pydantic serializer warning
- Update all tests to use routes without trailing slash
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>