(
self,
*,
app_name: str,
user_id: str,
session_id: Optional[str] = None,
state: Optional[dict[str, Any]] = None,
)
| 843 | ) |
| 844 | |
| 845 | async def _create_session( |
| 846 | self, |
| 847 | *, |
| 848 | app_name: str, |
| 849 | user_id: str, |
| 850 | session_id: Optional[str] = None, |
| 851 | state: Optional[dict[str, Any]] = None, |
| 852 | ) -> Session: |
| 853 | try: |
| 854 | session = await self.session_service.create_session( |
| 855 | app_name=app_name, |
| 856 | user_id=user_id, |
| 857 | state=state, |
| 858 | session_id=session_id, |
| 859 | ) |
| 860 | logger.info("New session created: %s", session.id) |
| 861 | return session |
| 862 | except AlreadyExistsError as e: |
| 863 | raise HTTPException( |
| 864 | status_code=409, detail=f"Session already exists: {session_id}" |
| 865 | ) from e |
| 866 | except Exception as e: |
| 867 | logger.error( |
| 868 | "Internal server error during session creation: %s", e, exc_info=True |
| 869 | ) |
| 870 | raise HTTPException(status_code=500, detail=str(e)) from e |
| 871 | |
| 872 | def get_fast_api_app( |
| 873 | self, |
no test coverage detected