feat(profile): add profile settings and LLM user context

This commit is contained in:
Piotr Oleszczyk 2026-03-05 15:57:21 +01:00
parent db3d9514d5
commit b99b9ed68e
25 changed files with 472 additions and 9 deletions

View 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