simple context added to standard mode

This commit is contained in:
serversdwn
2025-12-21 13:01:00 -05:00
parent d09425c37b
commit ceb60119fb
3 changed files with 79 additions and 26 deletions

View File

@@ -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 Intakes buffer and trigger full summarization.
into Intake's buffer and trigger full summarization.
"""
session_id = exchange.get("session_id")
if not session_id: