add. cleanup
This commit is contained in:
@@ -12,6 +12,8 @@ from persona.speak import speak
|
||||
from persona.identity import load_identity
|
||||
from ingest.intake_client import IntakeClient
|
||||
from context import collect_context, update_last_assistant_message
|
||||
from intake.intake import add_exchange_internal
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Debug configuration
|
||||
@@ -192,8 +194,34 @@ async def run_reason(req: ReasonRequest):
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Intake ingest passthrough
|
||||
# Intake ingest (internal feed)
|
||||
# -----------------------------
|
||||
class IngestPayload(BaseModel):
|
||||
session_id: str
|
||||
user_msg: str
|
||||
assistant_msg: str
|
||||
|
||||
@cortex_router.post("/ingest")
|
||||
async def ingest_stub():
|
||||
return {"status": "ok"}
|
||||
async def ingest(payload: IngestPayload):
|
||||
"""
|
||||
Relay calls this after /reason.
|
||||
We update Cortex state AND feed Intake's internal buffer.
|
||||
"""
|
||||
|
||||
# 1. Update Cortex session state
|
||||
update_last_assistant_message(payload.session_id, payload.assistant_msg)
|
||||
|
||||
# 2. Feed Intake internally (no HTTP)
|
||||
try:
|
||||
add_exchange_internal({
|
||||
"session_id": payload.session_id,
|
||||
"user_msg": payload.user_msg,
|
||||
"assistant_msg": payload.assistant_msg,
|
||||
})
|
||||
|
||||
logger.debug(f"[INGEST] Added exchange to Intake for {payload.session_id}")
|
||||
except Exception as e:
|
||||
logger.warning(f"[INGEST] Failed to add exchange to Intake: {e}")
|
||||
|
||||
return {"ok": True, "session_id": payload.session_id}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user