Class InputUserMessage

All Implemented Interfaces:
PropertyChangeSource, Rebindable

public class InputUserMessage extends UserMessage
A specialized UserMessage designed for direct manipulation by UI components like an input panel.

This class encapsulates the logic of managing a primary, editable text part, providing convenient methods to get and set its content. This avoids cluttering the generic UserMessage with UI-specific concerns and prevents unintended side effects on other subclasses like RagMessage.

Author:
Anahata
  • Field Details

    • editableTextPart

      private TextPart editableTextPart
      The primary, editable text part of this message.
  • Constructor Details

    • InputUserMessage

      public InputUserMessage(Agi agi)
      Constructs a new InputUserMessage bound to an active session context.
      Parameters:
      agi - The active Agi orchestrator.
  • Method Details

    • getText

      public String getText()
      Gets the text content of the primary editable part.
      Returns:
      The text content, or an empty string if no text part exists.
    • setText

      public void setText(String text)
      Sets the text content of the primary editable part. If the text is empty, the text part is automatically removed from the message.
      Parameters:
      text - The new text content.
    • getAttachments

      public List<BlobPart> getAttachments()
      Gets a list of all attached BlobParts.
      Returns:
      A list of BlobParts.
    • addAttachment

      public void addAttachment(Path path) throws Exception
      Adds a single file path as an attachment to this message.
      Parameters:
      path - The file path to attach.
      Throws:
      Exception - if a BlobPart cannot be created from the path (e.g., file read error).
    • addAttachment

      public void addAttachment(File file) throws Exception
      Adds a single File object as an attachment to this message.
      Parameters:
      file - The file to attach.
      Throws:
      Exception - if a BlobPart cannot be created from the file.
    • addAttachments

      public void addAttachments(Collection<Path> paths) throws Exception
      Adds a collection of file paths as attachments to this message.
      Parameters:
      paths - The collection of file paths to attach.
      Throws:
      Exception - if a BlobPart cannot be created from a path (e.g., file read error).