WIP: feature: Add before Guardrail #26
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user