maeser.flask_app.blueprints module

maeser.flask_app.blueprints module#

Blueprint definitions for the Maeser application.

This module sets up the Flask blueprint and associated routes for the Maeser application. It includes route handlers for chat interfaces, user management, feedback, and training functionalities.

class maeser.flask_app.blueprints.AppManager(app: flask.Flask, app_name: str, flask_secret_key: str, chat_session_manager: ChatSessionManager, user_manager: UserManager | None = None, main_logo_login: str | None = None, main_logo_chat: str | None = None, chat_head: str | None = None, favicon: str | None = None)[source]#

Bases: object

Manages the Maeser App and its configurations.

Takes in configuration for the Maeser application and applies the configuration when adding the Flask blueprint.

Running add_flask_blueprint() after initializing an AppManager object will return a Flask object with the blueprint added.

Parameters:
  • app (Flask) – The Flask application instance.

  • app_name (str | None, optional) – The name of the application.

  • flask_secret_key (str) – The secret key for the Flask application.

  • chat_session_manager (ChatSessionManager) – The chat session manager instance.

  • user_manager (UserManager | None, optional) – The user manager instance. Defaults to None.

  • main_logo_login (str | None, optional) – URL or path to the login logo. Defaults to None.

  • main_logo_chat (str | None, optional) – URL or path to the chat logo. Defaults to None.

  • chat_head (str | None, optional) – URL or path to the chat header image. Defaults to None.

  • favicon (str | None, optional) – URL or path to the favicon. Defaults to None.

add_flask_blueprint() flask.Flask[source]#

Adds the Maeser blueprint to the Flask application.

This function does not mutate the AppManager instance itself but rather returns a new Flask instance with the blueprint added.

Returns:

The Flask application instance with the blueprint registered.

Return type:

Flask