simple context added to standard mode
This commit is contained in:
@@ -326,11 +326,33 @@ def bg_summarize(session_id: str):
|
||||
# ─────────────────────────────
|
||||
# Internal entrypoint for Cortex
|
||||
# ─────────────────────────────
|
||||
def get_recent_messages(session_id: str, limit: int = 20) -> list:
|
||||
"""
|
||||
Get recent raw messages from the session buffer.
|
||||
|
||||
Args:
|
||||
session_id: Session identifier
|
||||
limit: Maximum number of messages to return (default 20)
|
||||
|
||||
Returns:
|
||||
List of message dicts with 'role' and 'content' fields
|
||||
"""
|
||||
if session_id not in SESSIONS:
|
||||
return []
|
||||
|
||||
buffer = SESSIONS[session_id]["buffer"]
|
||||
|
||||
# Convert buffer to list and get last N messages
|
||||
messages = list(buffer)[-limit:]
|
||||
|
||||
return messages
|
||||
|
||||
|
||||
def add_exchange_internal(exchange: dict):
|
||||
"""
|
||||
Direct internal call — bypasses FastAPI request handling.
|
||||
Cortex uses this to feed user/assistant turns directly
|
||||
into Intake’s buffer and trigger full summarization.
|
||||
into Intake's buffer and trigger full summarization.
|
||||
"""
|
||||
session_id = exchange.get("session_id")
|
||||
if not session_id:
|
||||
|
||||
Reference in New Issue
Block a user