File size: 496 Bytes
481dfe6
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from fastapi import APIRouter, HTTPException
from app.memory.session_store import delete_session

router = APIRouter(prefix="/api/sessions", tags=["sessions"])


@router.delete("/{session_id}")
async def clear_session(session_id: str):
    """Clear conversation history for a session."""
    deleted = delete_session(session_id)
    if not deleted:
        raise HTTPException(status_code=404, detail="Session not found.")
    return {"success": True, "message": "Session cleared."}