feat(api): include 7-day upcoming grooming context in routine suggestions
This commit is contained in:
parent
5d69a976c4
commit
1c457d62a3
3 changed files with 73 additions and 2 deletions
|
|
@ -249,6 +249,7 @@ def test_suggest_routine(client, session):
|
|||
assert data["reasoning"] == "because"
|
||||
kwargs = mock_gemini.call_args.kwargs
|
||||
assert "USER PROFILE:" in kwargs["contents"]
|
||||
assert "UPCOMING GROOMING (next 7 days):" in kwargs["contents"]
|
||||
assert "function_handlers" in kwargs
|
||||
assert "get_product_details" in kwargs["function_handlers"]
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ from innercontext.api.routines import (
|
|||
_build_products_context,
|
||||
_build_recent_history,
|
||||
_build_skin_context,
|
||||
_build_upcoming_grooming_context,
|
||||
_contains_minoxidil_text,
|
||||
_ev,
|
||||
_extract_active_names,
|
||||
|
|
@ -121,6 +122,29 @@ def test_build_grooming_context(session: Session):
|
|||
assert "(no entries for specified days)" in ctx2
|
||||
|
||||
|
||||
def test_build_upcoming_grooming_context(session: Session):
|
||||
assert (
|
||||
_build_upcoming_grooming_context(session, start_date=date(2026, 3, 2), days=7)
|
||||
== "UPCOMING GROOMING (next 7 days): none\n"
|
||||
)
|
||||
|
||||
monday = GroomingSchedule(
|
||||
id=uuid.uuid4(), day_of_week=0, action="shaving_oneblade", notes="Morning"
|
||||
)
|
||||
wednesday = GroomingSchedule(id=uuid.uuid4(), day_of_week=2, action="dermarolling")
|
||||
session.add_all([monday, wednesday])
|
||||
session.commit()
|
||||
|
||||
ctx = _build_upcoming_grooming_context(
|
||||
session,
|
||||
start_date=date(2026, 3, 2),
|
||||
days=7,
|
||||
)
|
||||
assert "UPCOMING GROOMING (next 7 days):" in ctx
|
||||
assert "dzisiaj (2026-03-02, poniedziałek): shaving_oneblade (Morning)" in ctx
|
||||
assert "za 2 dni (2026-03-04, środa): dermarolling" in ctx
|
||||
|
||||
|
||||
def test_build_recent_history(session: Session):
|
||||
assert _build_recent_history(session) == "RECENT ROUTINES: none\n"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue