fix(session): skip current model event when censoring previous user message
Some checks failed
CI / ci (pull_request) Failing after 12s
Some checks failed
CI / ci (pull_request) Failing after 12s
This commit is contained in:
@@ -400,8 +400,8 @@ class FirestoreSessionService(BaseSessionService):
|
|||||||
event_data = event_to_save.model_dump(mode="json", exclude_none=True)
|
event_data = event_to_save.model_dump(mode="json", exclude_none=True)
|
||||||
|
|
||||||
# Also censor the previous user message in Firestore
|
# Also censor the previous user message in Firestore
|
||||||
# Find the last user event in the session
|
# Find the last user event in the session (skip the current model event we just added)
|
||||||
for i in range(len(session.events) - 1, -1, -1):
|
for i in range(len(session.events) - 2, -1, -1):
|
||||||
prev_event = session.events[i]
|
prev_event = session.events[i]
|
||||||
if (
|
if (
|
||||||
prev_event.author == "user"
|
prev_event.author == "user"
|
||||||
|
|||||||
Reference in New Issue
Block a user