Class TimelineItemFactory

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

@Component("aitls_TimelineItemFactory") public class TimelineItemFactory extends Object
Creates TimelineItems from chat messages for rendering the conversation timeline.
  • Field Details

    • metadata

      @Autowired protected Metadata metadata
  • Constructor Details

    • TimelineItemFactory

      public TimelineItemFactory()
  • Method Details

    • createUserItem

      public TimelineItem createUserItem(AiChatMessage message)
      Creates a user timeline item for the given message.
      Parameters:
      message - message to wrap
      Returns:
      a new user timeline item
    • createAssistantItem

      public TimelineItem createAssistantItem(AiChatMessage message)
      Creates an assistant timeline item for the given message.
      Parameters:
      message - message to wrap
      Returns:
      a new assistant timeline item
    • createThinkingItem

      public TimelineItem createThinkingItem(AiChatMessage message)
      Creates a transient assistant "thinking" placeholder item for the given message.
      Parameters:
      message - message to wrap
      Returns:
      a new thinking placeholder timeline item
    • buildTimelineItems

      public List<TimelineItem> buildTimelineItems(Collection<AiChatMessage> messages)
      Maps chat messages to timeline items, wrapping AiChatMessageType.ASSISTANT / AiChatMessageType.TOOL messages as assistant items and the rest as user items.
      Parameters:
      messages - messages to map
      Returns:
      timeline items in the same order
    • createTimelineItem

      protected TimelineItem createTimelineItem(AiChatMessage message)