Class ConversationTitleSupport
java.lang.Object
io.jmix.aitoolsflowui.view.chat.support.ConversationTitleSupport
Builds conversation titles that fit
AiConversation.TITLE_MAX_LENGTH.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildInitialTitle(String rawMessage) Builds a title from the first user message: collapses whitespace and cuts an over-long text on a word boundary.protected StringcollapseWhitespace(String text) protected booleanisQuotePair(char opening, char closing) @Nullable StringsanitizeGeneratedTitle(@Nullable String rawTitle) Cleans a model-generated title: collapses whitespace, unwraps surrounding quotes and cuts an over-long text.protected StringstripSurroundingQuotes(String text) protected Stringprotected StringtruncateToLimit(String text)
-
Constructor Details
-
ConversationTitleSupport
public ConversationTitleSupport()
-
-
Method Details
-
buildInitialTitle
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
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
nullwhen the input isnullor blank
-
collapseWhitespace
-
truncateToLimit
-
stripTrailingPunctuation
-
stripSurroundingQuotes
-
isQuotePair
protected boolean isQuotePair(char opening, char closing)
-