maeser.controllers.conversation_history_api module#
Module for handling conversation history retrieval in a Flask API.
This module defines a controller function that retrieves the conversation history for a given session and branch. The conversation history is processed to handle system messages by applying HTML response formatting.
- maeser.controllers.conversation_history_api.controller(session_handler: ChatSessionManager) dict [source]#
Retrieves the conversation history for a given session and branch.
The function uses flask.request and expects a post request that contains ‘session’ and ‘branch’ keys, which are used to retrieve the conversation history from session_handler. If the conversation history contains ‘messages’, it iterates through them and processes the content of system messages using maeser.render.get_response_html(). Finally, it returns the conversation history as a JSON response.
- Parameters:
session_handler (ChatSessionManager) – The chat session manager for the Maeser application.
- Returns:
- A dictionary containing the conversation history, with system
messages having their content processed by get_response_html().
- Return type:
dict