maeser.controllers.new_session_api module

Contents

maeser.controllers.new_session_api module#

This module handles API requests for creating new chat sessions.

It uses the ChatSessionManager to manage session creation and optionally integrates with user management through Flask-Login’s current_user.

maeser.controllers.new_session_api.controller(session_handler: ChatSessionManager, user_management: bool = False) dict[str, str][source]#

Handle session requests and return the response from session_handler.

The response is formatted like so:

  • {'response': '<response>'}, if successful.

  • {'response': 'invalid', 'details': 'Requested session type is not valid'} if unsuccessful.

Parameters:
  • session_handler (ChatSessionManager) – The session handler instance.

  • user_management (bool) – Flag to indicate if user management is enabled.

Returns:

The response from session_handler.

Return type:

dict