WIP: feature: Add before Guardrail #26

Draft
A8080816 wants to merge 16 commits from feature/before-guardrail into main
Showing only changes of commit 6ce548e718 - Show all commits

View File

@@ -400,8 +400,8 @@ class FirestoreSessionService(BaseSessionService):
event_data = event_to_save.model_dump(mode="json", exclude_none=True)
# Also censor the previous user message in Firestore
# Find the last user event in the session
for i in range(len(session.events) - 1, -1, -1):
# Find the last user event in the session (skip the current model event we just added)
for i in range(len(session.events) - 2, -1, -1):
prev_event = session.events[i]
if (
prev_event.author == "user"