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
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue