Class ChatMessage

java.lang.Object
org.codelibs.fess.entity.ChatMessage
All Implemented Interfaces:
Serializable

public class ChatMessage extends Object implements Serializable
Represents a message in a chat conversation.
Author:
FessProject
See Also:
  • Field Details

  • Constructor Details

    • ChatMessage

      public ChatMessage()
      Default constructor.
    • ChatMessage

      public ChatMessage(String role, String content)
      Creates a new chat message with the specified role and content.
      Parameters:
      role - the message role
      content - the message content
  • Method Details

    • userMessage

      public static ChatMessage userMessage(String content)
      Creates a user message with the specified content.
      Parameters:
      content - the message content
      Returns:
      a new user message
    • assistantMessage

      public static ChatMessage assistantMessage(String content)
      Creates an assistant message with the specified content.
      Parameters:
      content - the message content
      Returns:
      a new assistant message
    • getId

      public String getId()
      Gets the message ID.
      Returns:
      the message ID
    • setId

      public void setId(String id)
      Sets the message ID.
      Parameters:
      id - the message ID
    • getRole

      public String getRole()
      Gets the message role.
      Returns:
      the message role
    • setRole

      public void setRole(String role)
      Sets the message role.
      Parameters:
      role - the message role
    • getContent

      public String getContent()
      Gets the message content.
      Returns:
      the message content
    • setContent

      public void setContent(String content)
      Sets the message content.
      Parameters:
      content - the message content
    • getTimestamp

      public LocalDateTime getTimestamp()
      Gets the message timestamp.
      Returns:
      the message timestamp
    • setTimestamp

      public void setTimestamp(LocalDateTime timestamp)
      Sets the message timestamp.
      Parameters:
      timestamp - the message timestamp
    • getSources

      public List<ChatMessage.ChatSource> getSources()
      Gets the list of sources referenced in the message.
      Returns:
      the list of sources
    • setSources

      public void setSources(List<ChatMessage.ChatSource> sources)
      Sets the list of sources referenced in the message.
      Parameters:
      sources - the list of sources
    • addSource

      public void addSource(ChatMessage.ChatSource source)
      Adds a source to the message.
      Parameters:
      source - the source to add
    • isUser

      public boolean isUser()
      Checks if this is a user message.
      Returns:
      true if this is a user message
    • isAssistant

      public boolean isAssistant()
      Checks if this is an assistant message.
      Returns:
      true if this is an assistant message
    • getHtmlContent

      public String getHtmlContent()
      Gets the HTML-rendered content.
      Returns:
      the HTML content, or null if not rendered
    • setHtmlContent

      public void setHtmlContent(String htmlContent)
      Sets the HTML-rendered content.
      Parameters:
      htmlContent - the HTML content
    • getSearchQuery

      public String getSearchQuery()
      Gets the final search query for this assistant turn.
      Returns:
      the search query, or null
    • setSearchQuery

      public void setSearchQuery(String searchQuery)
      Sets the final search query for this assistant turn.
      Parameters:
      searchQuery - the search query