Spaces:
Sleeping
Sleeping
| import uuid | |
| from typing import Annotated | |
| from fastapi import Header | |
| async def get_session_id(x_session_id: Annotated[str | None, Header()] = None) -> str: | |
| """ | |
| Return the session ID from the X-Session-Id header. | |
| If the header is absent, generate a fresh UUID so every resource | |
| is still scoped to *some* session. | |
| """ | |
| return x_session_id or str(uuid.uuid4()) | |