maeser.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.

© 2024 Blaine Freestone, Carson Bush, Gohaun Manley

This file is part of Maeser.

Maeser is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

Maeser is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with Maeser. If not, see <https://www.gnu.org/licenses/>.

class maeser.blueprints.App_Manager(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, login_text: str | None = None, changelog: str | None = None, chat_greeting: str = 'Hello, how can I help you today?', branch_response: str = "Okay, I'll help you with ${action}!", animation: bool = False, primary_color: str = '#f5f5f5', secondary_color: str = '#ccc', button_color: str = '#0084ff', button_color_active: str = '#009e15', button_color_inactive: str = '#e9e9e9', fafa_button: str = '#b8b8b8', logout_button: str = '#000000', new_chat_button: str = '#000000', help_train_button: str = '#a8a8a8')[source]#

Bases: object

Manages the Maeser App and its configurations.

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.

  • login_text (str | None, optional) – Text to display on the login page. Defaults to None.

  • changelog (str | None, optional) – Text to display as the changelog. Defaults to None.

  • chat_greeting (str, optional) – Greeting message to display in the chat. Defaults to “Hello, how can I help you today?”.

  • branch_response (str, optional) – Response message to display when a branch is selected. Defaults to “Okay, I’ll help you with ${action}!”.

  • animation (bool, optional) – Whether to enable toggle animations. Defaults to False.

  • primary_color (str, optional) – Primary color of the application. Defaults to “#333”.

  • secondary_color (str, optional) – Secondary color of the application. Defaults to “#ccc”.

  • button_color (str, optional) – Color of the buttons. Defaults to “#0084ff”.

  • button_color_active (str, optional) – Color of the active buttons. Defaults to “#009e15”.

  • button_color_inactive (str, optional) – Color of the inactive buttons. Defaults to “#ddd”.

  • fafa_button (str, optional) – Color of the fafa buttons. Defaults to “#eee”.

  • logout_button (str, optional) – Color of the logout button. Defaults to “#333”.

  • new_chat_button (str, optional) – Color of the new chat button. Defaults to “#333”.

  • help_train_button (str, optional) – Color of the help train button. Defaults to “#eee”.

add_flask_blueprint() flask.Flask[source]#

Add the Maeser blueprint to the Flask application.

Returns:

The Flask application instance with the blueprint registered.

Return type:

Flask

template_chat_interface()[source]#

Template the chat_interface.html file using Jinja2 templating

template_feedback()[source]#

Template the feedback_form.html file using Jinja2 templating

template_login()[source]#

Template the login.html file using Jinja2 templating

template_styles_css()[source]#

Template the styles.css file using Jinja2 templating

template_training()[source]#

Template the training.html file using Jinja2 templating