maeser.controllers.feedback_api module

Contents

maeser.controllers.feedback_api module#

Module for handling feedback for messages through a controller.

This module defines a controller function that processes feedback for messages. The feedback includes information such as the branch, session ID, message, whether it is a like or dislike, and the index of the message.

maeser.controllers.feedback_api.controller(session_handler: ChatSessionManager) → dict[source]#

Handles feedback for messages.

Uses flask.request and expects a post request with the following fields:

  • “branch” (str): The chat branch of the session.

  • “session_id” (str): The ID of the chat session.

  • “message” (str): The text content of the message that received feedback.

  • “like” (bool): True if the feedback was a like; False if the feedback was a dislike.

  • “index” (int): The index of the message in the conversation history.

Parameters:

session_handler (ChatSessionManager) – The session handler to manage chat sessions and feedback.

Returns:

Status of the feedback submission. Returns {'status': 'success'} if the feedback submission was successful.

Return type:

dict