feat(profile): add profile settings and LLM user context
This commit is contained in:
parent
db3d9514d5
commit
b99b9ed68e
25 changed files with 472 additions and 9 deletions
|
|
@ -0,0 +1,45 @@
|
|||
"""add_user_profile_table
|
||||
|
||||
Revision ID: 1f7e3b9c4a2d
|
||||
Revises: 8e4c1b7a9d2f
|
||||
Create Date: 2026-03-05 00:00:00.000000
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision: str = "1f7e3b9c4a2d"
|
||||
down_revision: Union[str, None] = "8e4c1b7a9d2f"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.create_table(
|
||||
"user_profiles",
|
||||
sa.Column("id", sa.Uuid(), nullable=False),
|
||||
sa.Column("birth_date", sa.Date(), nullable=True),
|
||||
sa.Column("sex_at_birth", sa.String(length=16), nullable=True),
|
||||
sa.Column("created_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.CheckConstraint(
|
||||
"sex_at_birth IN ('male', 'female', 'intersex')",
|
||||
name="ck_user_profiles_sex_at_birth",
|
||||
),
|
||||
sa.PrimaryKeyConstraint("id"),
|
||||
)
|
||||
op.create_index(
|
||||
op.f("ix_user_profiles_sex_at_birth"),
|
||||
"user_profiles",
|
||||
["sex_at_birth"],
|
||||
unique=False,
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_index(op.f("ix_user_profiles_sex_at_birth"), table_name="user_profiles")
|
||||
op.drop_table("user_profiles")
|
||||
44
backend/innercontext/api/llm_context.py
Normal file
44
backend/innercontext/api/llm_context.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
from datetime import date
|
||||
|
||||
from sqlmodel import Session, col, select
|
||||
|
||||
from innercontext.models import UserProfile
|
||||
|
||||
|
||||
def get_user_profile(session: Session) -> UserProfile | None:
|
||||
return session.exec(
|
||||
select(UserProfile).order_by(col(UserProfile.created_at).desc())
|
||||
).first()
|
||||
|
||||
|
||||
def calculate_age(birth_date: date, reference_date: date) -> int:
|
||||
years = reference_date.year - birth_date.year
|
||||
if (reference_date.month, reference_date.day) < (birth_date.month, birth_date.day):
|
||||
years -= 1
|
||||
return years
|
||||
|
||||
|
||||
def build_user_profile_context(session: Session, reference_date: date) -> str:
|
||||
profile = get_user_profile(session)
|
||||
if profile is None:
|
||||
return "USER PROFILE: no data\n"
|
||||
|
||||
lines = ["USER PROFILE:"]
|
||||
if profile.birth_date is not None:
|
||||
age = calculate_age(profile.birth_date, reference_date)
|
||||
lines.append(f" Age: {max(age, 0)}")
|
||||
lines.append(f" Birth date: {profile.birth_date.isoformat()}")
|
||||
else:
|
||||
lines.append(" Age: unknown")
|
||||
|
||||
if profile.sex_at_birth is not None:
|
||||
sex_value = (
|
||||
profile.sex_at_birth.value
|
||||
if hasattr(profile.sex_at_birth, "value")
|
||||
else str(profile.sex_at_birth)
|
||||
)
|
||||
lines.append(f" Sex at birth: {sex_value}")
|
||||
else:
|
||||
lines.append(" Sex at birth: unknown")
|
||||
|
||||
return "\n".join(lines) + "\n"
|
||||
|
|
@ -12,6 +12,7 @@ from sqlmodel import Field, Session, SQLModel, col, select
|
|||
|
||||
from db import get_session
|
||||
from innercontext.api.utils import get_or_404
|
||||
from innercontext.api.llm_context import build_user_profile_context
|
||||
from innercontext.llm import (
|
||||
call_gemini,
|
||||
call_gemini_with_function_tools,
|
||||
|
|
@ -786,7 +787,8 @@ def _ev(v: object) -> str:
|
|||
return str(v)
|
||||
|
||||
|
||||
def _build_shopping_context(session: Session) -> str:
|
||||
def _build_shopping_context(session: Session, reference_date: date) -> str:
|
||||
profile_ctx = build_user_profile_context(session, reference_date=reference_date)
|
||||
snapshot = session.exec(
|
||||
select(SkinConditionSnapshot).order_by(
|
||||
col(SkinConditionSnapshot.snapshot_date).desc()
|
||||
|
|
@ -854,7 +856,9 @@ def _build_shopping_context(session: Session) -> str:
|
|||
f"targets: {targets}{actives_str}{effects_str}"
|
||||
)
|
||||
|
||||
return "\n".join(skin_lines) + "\n\n" + "\n".join(products_lines)
|
||||
return (
|
||||
profile_ctx + "\n" + "\n".join(skin_lines) + "\n\n" + "\n".join(products_lines)
|
||||
)
|
||||
|
||||
|
||||
def _get_shopping_products(session: Session) -> list[Product]:
|
||||
|
|
@ -1067,7 +1071,7 @@ Format odpowiedzi - zwróć wyłącznie JSON zgodny z podanym schematem."""
|
|||
|
||||
@router.post("/suggest", response_model=ShoppingSuggestionResponse)
|
||||
def suggest_shopping(session: Session = Depends(get_session)):
|
||||
context = _build_shopping_context(session)
|
||||
context = _build_shopping_context(session, reference_date=date.today())
|
||||
shopping_products = _get_shopping_products(session)
|
||||
|
||||
prompt = (
|
||||
|
|
|
|||
62
backend/innercontext/api/profile.py
Normal file
62
backend/innercontext/api/profile.py
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
from datetime import date, datetime
|
||||
from typing import Optional
|
||||
|
||||
from fastapi import APIRouter, Depends
|
||||
from sqlmodel import Session, SQLModel
|
||||
|
||||
from db import get_session
|
||||
from innercontext.api.llm_context import get_user_profile
|
||||
from innercontext.models import SexAtBirth, UserProfile
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
class UserProfileUpdate(SQLModel):
|
||||
birth_date: Optional[date] = None
|
||||
sex_at_birth: Optional[SexAtBirth] = None
|
||||
|
||||
|
||||
class UserProfilePublic(SQLModel):
|
||||
id: str
|
||||
birth_date: date | None
|
||||
sex_at_birth: SexAtBirth | None
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
@router.get("", response_model=UserProfilePublic | None)
|
||||
def get_profile(session: Session = Depends(get_session)):
|
||||
profile = get_user_profile(session)
|
||||
if profile is None:
|
||||
return None
|
||||
return UserProfilePublic(
|
||||
id=str(profile.id),
|
||||
birth_date=profile.birth_date,
|
||||
sex_at_birth=profile.sex_at_birth,
|
||||
created_at=profile.created_at,
|
||||
updated_at=profile.updated_at,
|
||||
)
|
||||
|
||||
|
||||
@router.patch("", response_model=UserProfilePublic)
|
||||
def upsert_profile(data: UserProfileUpdate, session: Session = Depends(get_session)):
|
||||
profile = get_user_profile(session)
|
||||
payload = data.model_dump(exclude_unset=True)
|
||||
|
||||
if profile is None:
|
||||
profile = UserProfile(**payload)
|
||||
else:
|
||||
for key, value in payload.items():
|
||||
setattr(profile, key, value)
|
||||
|
||||
session.add(profile)
|
||||
session.commit()
|
||||
session.refresh(profile)
|
||||
|
||||
return UserProfilePublic(
|
||||
id=str(profile.id),
|
||||
birth_date=profile.birth_date,
|
||||
sex_at_birth=profile.sex_at_birth,
|
||||
created_at=profile.created_at,
|
||||
updated_at=profile.updated_at,
|
||||
)
|
||||
|
|
@ -10,6 +10,7 @@ from sqlmodel import Field, Session, SQLModel, col, select
|
|||
|
||||
from db import get_session
|
||||
from innercontext.api.utils import get_or_404
|
||||
from innercontext.api.llm_context import build_user_profile_context
|
||||
from innercontext.llm import (
|
||||
call_gemini,
|
||||
call_gemini_with_function_tools,
|
||||
|
|
@ -760,6 +761,7 @@ def suggest_routine(
|
|||
):
|
||||
weekday = data.routine_date.weekday()
|
||||
skin_ctx = _build_skin_context(session)
|
||||
profile_ctx = build_user_profile_context(session, reference_date=data.routine_date)
|
||||
grooming_ctx = _build_grooming_context(session, weekdays=[weekday])
|
||||
history_ctx = _build_recent_history(session)
|
||||
day_ctx = _build_day_context(data.leaving_home)
|
||||
|
|
@ -781,7 +783,7 @@ def suggest_routine(
|
|||
f"na {data.routine_date} ({day_name}).\n\n"
|
||||
f"{mode_line}\n"
|
||||
"INPUT DATA:\n"
|
||||
f"{skin_ctx}\n{grooming_ctx}\n{history_ctx}\n{day_ctx}\n{products_ctx}\n{objectives_ctx}"
|
||||
f"{profile_ctx}\n{skin_ctx}\n{grooming_ctx}\n{history_ctx}\n{day_ctx}\n{products_ctx}\n{objectives_ctx}"
|
||||
"\nNARZEDZIA:\n"
|
||||
"- Masz dostep do funkcji: get_product_inci, get_product_safety_rules, get_product_actives.\n"
|
||||
"- Wywoluj narzedzia tylko, gdy potrzebujesz detali do decyzji klinicznej/bezpieczenstwa.\n"
|
||||
|
|
@ -924,6 +926,7 @@ def suggest_batch(
|
|||
weekdays = list(
|
||||
{(data.from_date + timedelta(days=i)).weekday() for i in range(delta)}
|
||||
)
|
||||
profile_ctx = build_user_profile_context(session, reference_date=data.from_date)
|
||||
skin_ctx = _build_skin_context(session)
|
||||
grooming_ctx = _build_grooming_context(session, weekdays=weekdays)
|
||||
history_ctx = _build_recent_history(session)
|
||||
|
|
@ -950,7 +953,7 @@ def suggest_batch(
|
|||
prompt = (
|
||||
f"Zaproponuj plan pielęgnacji AM + PM dla każdego dnia z zakresu:\n{dates_str}\n\n{mode_line}\n"
|
||||
"INPUT DATA:\n"
|
||||
f"{skin_ctx}\n{grooming_ctx}\n{history_ctx}\n{products_ctx}\n{objectives_ctx}"
|
||||
f"{profile_ctx}\n{skin_ctx}\n{grooming_ctx}\n{history_ctx}\n{products_ctx}\n{objectives_ctx}"
|
||||
f"{notes_line}{minimize_line}"
|
||||
"\nZwróć JSON zgodny ze schematem."
|
||||
)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from pydantic import ValidationError
|
|||
from sqlmodel import Session, SQLModel, select
|
||||
|
||||
from db import get_session
|
||||
from innercontext.api.llm_context import build_user_profile_context
|
||||
from innercontext.api.utils import get_or_404
|
||||
from innercontext.llm import call_gemini, get_extraction_config
|
||||
from innercontext.models import (
|
||||
|
|
@ -136,6 +137,7 @@ MAX_IMAGE_BYTES = 5 * 1024 * 1024 # 5 MB
|
|||
@router.post("/analyze-photos", response_model=SkinPhotoAnalysisResponse)
|
||||
async def analyze_skin_photos(
|
||||
photos: list[UploadFile] = File(...),
|
||||
session: Session = Depends(get_session),
|
||||
) -> SkinPhotoAnalysisResponse:
|
||||
if not (1 <= len(photos) <= 3):
|
||||
raise HTTPException(status_code=422, detail="Send between 1 and 3 photos.")
|
||||
|
|
@ -166,6 +168,11 @@ async def analyze_skin_photos(
|
|||
text="Analyze the skin condition visible in the above photo(s) and return the JSON assessment."
|
||||
)
|
||||
)
|
||||
parts.append(
|
||||
genai_types.Part.from_text(
|
||||
text=build_user_profile_context(session, reference_date=date.today())
|
||||
)
|
||||
)
|
||||
|
||||
image_summary = f"{len(photos)} image(s): {', '.join((p.content_type or 'unknown') for p in photos)}"
|
||||
response = call_gemini(
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ from .enums import (
|
|||
ProductCategory,
|
||||
ResultFlag,
|
||||
RoutineRole,
|
||||
SexAtBirth,
|
||||
SkinConcern,
|
||||
SkinTexture,
|
||||
SkinType,
|
||||
|
|
@ -33,6 +34,7 @@ from .product import (
|
|||
ProductWithInventory,
|
||||
)
|
||||
from .pricing import PricingRecalcJob
|
||||
from .profile import UserProfile
|
||||
from .routine import GroomingSchedule, Routine, RoutineStep
|
||||
from .skincare import (
|
||||
SkinConditionSnapshot,
|
||||
|
|
@ -59,6 +61,7 @@ __all__ = [
|
|||
"ProductCategory",
|
||||
"ResultFlag",
|
||||
"RoutineRole",
|
||||
"SexAtBirth",
|
||||
"SkinConcern",
|
||||
"SkinTexture",
|
||||
"SkinType",
|
||||
|
|
@ -79,6 +82,7 @@ __all__ = [
|
|||
"ProductPublic",
|
||||
"ProductWithInventory",
|
||||
"PricingRecalcJob",
|
||||
"UserProfile",
|
||||
# routine
|
||||
"GroomingSchedule",
|
||||
"Routine",
|
||||
|
|
|
|||
|
|
@ -153,6 +153,12 @@ class MedicationKind(str, Enum):
|
|||
OTHER = "other"
|
||||
|
||||
|
||||
class SexAtBirth(str, Enum):
|
||||
MALE = "male"
|
||||
FEMALE = "female"
|
||||
INTERSEX = "intersex"
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Routine
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
35
backend/innercontext/models/profile.py
Normal file
35
backend/innercontext/models/profile.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
from datetime import date, datetime
|
||||
from typing import ClassVar
|
||||
from uuid import UUID, uuid4
|
||||
|
||||
from sqlalchemy import Column, DateTime, String
|
||||
from sqlmodel import Field, SQLModel
|
||||
|
||||
from .base import utc_now
|
||||
from .domain import Domain
|
||||
from .enums import SexAtBirth
|
||||
|
||||
|
||||
class UserProfile(SQLModel, table=True):
|
||||
__tablename__ = "user_profiles"
|
||||
__domains__: ClassVar[frozenset[Domain]] = frozenset(
|
||||
{Domain.HEALTH, Domain.SKINCARE}
|
||||
)
|
||||
|
||||
id: UUID = Field(default_factory=uuid4, primary_key=True)
|
||||
birth_date: date | None = Field(default=None)
|
||||
sex_at_birth: SexAtBirth | None = Field(
|
||||
default=None,
|
||||
sa_column=Column(String(length=16), nullable=True, index=True),
|
||||
)
|
||||
|
||||
created_at: datetime = Field(default_factory=utc_now, nullable=False)
|
||||
updated_at: datetime = Field(
|
||||
default_factory=utc_now,
|
||||
sa_column=Column(
|
||||
DateTime(timezone=True),
|
||||
default=utc_now,
|
||||
onupdate=utc_now,
|
||||
nullable=False,
|
||||
),
|
||||
)
|
||||
|
|
@ -14,6 +14,7 @@ from innercontext.api import ( # noqa: E402
|
|||
ai_logs,
|
||||
health,
|
||||
inventory,
|
||||
profile,
|
||||
products,
|
||||
routines,
|
||||
skincare,
|
||||
|
|
@ -48,6 +49,7 @@ app.add_middleware(
|
|||
|
||||
app.include_router(products.router, prefix="/products", tags=["products"])
|
||||
app.include_router(inventory.router, prefix="/inventory", tags=["inventory"])
|
||||
app.include_router(profile.router, prefix="/profile", tags=["profile"])
|
||||
app.include_router(health.router, prefix="/health", tags=["health"])
|
||||
app.include_router(routines.router, prefix="/routines", tags=["routines"])
|
||||
app.include_router(skincare.router, prefix="/skincare", tags=["skincare"])
|
||||
|
|
|
|||
23
backend/tests/test_llm_profile_context.py
Normal file
23
backend/tests/test_llm_profile_context.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
from datetime import date
|
||||
|
||||
from sqlmodel import Session
|
||||
|
||||
from innercontext.api.llm_context import build_user_profile_context
|
||||
from innercontext.models import SexAtBirth, UserProfile
|
||||
|
||||
|
||||
def test_build_user_profile_context_without_data(session: Session):
|
||||
ctx = build_user_profile_context(session, reference_date=date(2026, 3, 5))
|
||||
assert ctx == "USER PROFILE: no data\n"
|
||||
|
||||
|
||||
def test_build_user_profile_context_with_data(session: Session):
|
||||
profile = UserProfile(birth_date=date(1990, 3, 20), sex_at_birth=SexAtBirth.FEMALE)
|
||||
session.add(profile)
|
||||
session.commit()
|
||||
|
||||
ctx = build_user_profile_context(session, reference_date=date(2026, 3, 5))
|
||||
assert "USER PROFILE:" in ctx
|
||||
assert "Age: 35" in ctx
|
||||
assert "Birth date: 1990-03-20" in ctx
|
||||
assert "Sex at birth: female" in ctx
|
||||
|
|
@ -11,15 +11,26 @@ from innercontext.api.products import (
|
|||
_build_shopping_context,
|
||||
_extract_requested_product_ids,
|
||||
)
|
||||
from innercontext.models import Product, ProductInventory, SkinConditionSnapshot
|
||||
from innercontext.models import (
|
||||
Product,
|
||||
ProductInventory,
|
||||
SexAtBirth,
|
||||
SkinConditionSnapshot,
|
||||
)
|
||||
from innercontext.models.profile import UserProfile
|
||||
|
||||
|
||||
def test_build_shopping_context(session: Session):
|
||||
# Empty context
|
||||
ctx = _build_shopping_context(session)
|
||||
ctx = _build_shopping_context(session, reference_date=date.today())
|
||||
assert "USER PROFILE: no data" in ctx
|
||||
assert "(brak danych)" in ctx
|
||||
assert "POSIADANE PRODUKTY" in ctx
|
||||
|
||||
profile = UserProfile(birth_date=date(1990, 1, 10), sex_at_birth=SexAtBirth.MALE)
|
||||
session.add(profile)
|
||||
session.commit()
|
||||
|
||||
# Add snapshot
|
||||
snap = SkinConditionSnapshot(
|
||||
id=uuid.uuid4(),
|
||||
|
|
@ -54,7 +65,10 @@ def test_build_shopping_context(session: Session):
|
|||
session.add(inv)
|
||||
session.commit()
|
||||
|
||||
ctx = _build_shopping_context(session)
|
||||
ctx = _build_shopping_context(session, reference_date=date(2026, 3, 5))
|
||||
assert "USER PROFILE:" in ctx
|
||||
assert "Age: 36" in ctx
|
||||
assert "Sex at birth: male" in ctx
|
||||
assert "Typ skóry: combination" in ctx
|
||||
assert "Nawilżenie: 3/5" in ctx
|
||||
assert "Wrażliwość: 4/5" in ctx
|
||||
|
|
@ -91,6 +105,7 @@ def test_suggest_shopping(client, session):
|
|||
assert data["suggestions"][0]["product_type"] == "cleanser"
|
||||
assert data["reasoning"] == "Test shopping"
|
||||
kwargs = mock_gemini.call_args.kwargs
|
||||
assert "USER PROFILE:" in kwargs["contents"]
|
||||
assert "function_handlers" in kwargs
|
||||
assert "get_product_inci" in kwargs["function_handlers"]
|
||||
assert "get_product_safety_rules" in kwargs["function_handlers"]
|
||||
|
|
@ -111,7 +126,7 @@ def test_shopping_context_medication_skip(session: Session):
|
|||
session.add(p)
|
||||
session.commit()
|
||||
|
||||
ctx = _build_shopping_context(session)
|
||||
ctx = _build_shopping_context(session, reference_date=date.today())
|
||||
assert "Epiduo" not in ctx
|
||||
|
||||
|
||||
|
|
|
|||
35
backend/tests/test_profile.py
Normal file
35
backend/tests/test_profile.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
def test_get_profile_empty(client):
|
||||
r = client.get("/profile")
|
||||
assert r.status_code == 200
|
||||
assert r.json() is None
|
||||
|
||||
|
||||
def test_upsert_profile_create_and_get(client):
|
||||
create = client.patch(
|
||||
"/profile", json={"birth_date": "1990-01-15", "sex_at_birth": "male"}
|
||||
)
|
||||
assert create.status_code == 200
|
||||
body = create.json()
|
||||
assert body["birth_date"] == "1990-01-15"
|
||||
assert body["sex_at_birth"] == "male"
|
||||
|
||||
fetch = client.get("/profile")
|
||||
assert fetch.status_code == 200
|
||||
fetched = fetch.json()
|
||||
assert fetched is not None
|
||||
assert fetched["id"] == body["id"]
|
||||
|
||||
|
||||
def test_upsert_profile_updates_existing_row(client):
|
||||
first = client.patch(
|
||||
"/profile", json={"birth_date": "1992-06-10", "sex_at_birth": "female"}
|
||||
)
|
||||
assert first.status_code == 200
|
||||
first_id = first.json()["id"]
|
||||
|
||||
second = client.patch("/profile", json={"sex_at_birth": "intersex"})
|
||||
assert second.status_code == 200
|
||||
second_body = second.json()
|
||||
assert second_body["id"] == first_id
|
||||
assert second_body["birth_date"] == "1992-06-10"
|
||||
assert second_body["sex_at_birth"] == "intersex"
|
||||
|
|
@ -248,6 +248,7 @@ def test_suggest_routine(client, session):
|
|||
assert data["steps"][0]["action_type"] == "shaving_razor"
|
||||
assert data["reasoning"] == "because"
|
||||
kwargs = mock_gemini.call_args.kwargs
|
||||
assert "USER PROFILE:" in kwargs["contents"]
|
||||
assert "function_handlers" in kwargs
|
||||
assert "get_product_inci" in kwargs["function_handlers"]
|
||||
assert "get_product_safety_rules" in kwargs["function_handlers"]
|
||||
|
|
@ -279,6 +280,8 @@ def test_suggest_batch(client, session):
|
|||
assert len(data["days"]) == 1
|
||||
assert data["days"][0]["date"] == "2026-03-03"
|
||||
assert data["overall_reasoning"] == "batch test"
|
||||
kwargs = mock_gemini.call_args.kwargs
|
||||
assert "USER PROFILE:" in kwargs["contents"]
|
||||
|
||||
|
||||
def test_suggest_batch_invalid_date_range(client):
|
||||
|
|
|
|||
|
|
@ -128,3 +128,33 @@ def test_delete_snapshot(client):
|
|||
def test_delete_snapshot_not_found(client):
|
||||
r = client.delete(f"/skincare/{uuid.uuid4()}")
|
||||
assert r.status_code == 404
|
||||
|
||||
|
||||
def test_analyze_photos_includes_user_profile_context(client, monkeypatch):
|
||||
from innercontext.api import skincare as skincare_api
|
||||
|
||||
captured: dict[str, object] = {}
|
||||
|
||||
class _FakeResponse:
|
||||
text = "{}"
|
||||
|
||||
def _fake_call_gemini(**kwargs):
|
||||
captured.update(kwargs)
|
||||
return _FakeResponse()
|
||||
|
||||
monkeypatch.setattr(skincare_api, "call_gemini", _fake_call_gemini)
|
||||
|
||||
profile = client.patch(
|
||||
"/profile", json={"birth_date": "1991-02-10", "sex_at_birth": "female"}
|
||||
)
|
||||
assert profile.status_code == 200
|
||||
|
||||
r = client.post(
|
||||
"/skincare/analyze-photos",
|
||||
files={"photos": ("face.jpg", b"fake-bytes", "image/jpeg")},
|
||||
)
|
||||
assert r.status_code == 200
|
||||
|
||||
parts = captured["contents"]
|
||||
assert isinstance(parts, list)
|
||||
assert any("USER PROFILE:" in str(part) for part in parts)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue