doc-service: persist doc_context by stable session key
This commit is contained in:
@@ -105,10 +105,9 @@ class DocumentService:
|
||||
True if saved successfully
|
||||
"""
|
||||
try:
|
||||
# Extract fallback user_id from session_id if not provided.
|
||||
# Format: "channel:identifier" or "channel:user_id"
|
||||
parts = session_id.split(":", 1)
|
||||
fact_user_id = user_id or (parts[1] if len(parts) > 1 else session_id)
|
||||
# Use stable synthetic user key per session, so context can be
|
||||
# retrieved later using only session_id (without caller user_id).
|
||||
fact_user_id = f"session:{session_id}"
|
||||
|
||||
# Save as fact in Memory Service
|
||||
fact_key = f"doc_context:{session_id}"
|
||||
@@ -148,8 +147,7 @@ class DocumentService:
|
||||
DocContext or None
|
||||
"""
|
||||
try:
|
||||
parts = session_id.split(":", 1)
|
||||
user_id = parts[1] if len(parts) > 1 else session_id
|
||||
user_id = f"session:{session_id}"
|
||||
|
||||
fact_key = f"doc_context:{session_id}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user