Class ConversationTitleSupport

java.lang.Object
io.jmix.aitoolsflowui.view.chat.support.ConversationTitleSupport

@Component("aitls_ConversationTitleSupport") public class ConversationTitleSupport extends Object
Builds conversation titles that fit AiConversation.TITLE_MAX_LENGTH.
  • Constructor Details

    • ConversationTitleSupport

      public ConversationTitleSupport()
  • Method Details

    • buildInitialTitle

      public String buildInitialTitle(String rawMessage)
      Builds a title from the first user message: collapses whitespace and cuts an over-long text on a word boundary.
      Parameters:
      rawMessage - the first user message text
      Returns:
      the title
    • sanitizeGeneratedTitle

      public @Nullable String sanitizeGeneratedTitle(@Nullable String rawTitle)
      Cleans a model-generated title: collapses whitespace, unwraps surrounding quotes and cuts an over-long text.
      Parameters:
      rawTitle - the raw model output
      Returns:
      the cleaned title, or null when the input is null or blank
    • collapseWhitespace

      protected String collapseWhitespace(String text)
    • truncateToLimit

      protected String truncateToLimit(String text)
    • stripTrailingPunctuation

      protected String stripTrailingPunctuation(String text)
    • stripSurroundingQuotes

      protected String stripSurroundingQuotes(String text)
    • isQuotePair

      protected boolean isQuotePair(char opening, char closing)