Logging and Chat History

This section describes the logging and chat history functionality in the Dify client.

Chat Session

class Chat

Represents a chat conversation session. Used for tracking and retrieving message history.

__init__(client: DifyBaseClient, app: App, id: str, info: dict = None)

Initialize a new chat session.

Parameters:
  • client – The Dify client instance

  • app – The parent application instance

  • id – Unique identifier for the chat session

  • info – Optional additional information about the chat session

property messages(max_pages: int = 10) list

Retrieves chat messages for the conversation, with pagination support. Returns a list of message dictionaries.

Parameters:

max_pages – Maximum number of pages to retrieve (default: 10)

Returns:

List of message dictionaries containing conversation history