Interface AIInput

All Superinterfaces:
Serializable

public interface AIInput extends Serializable
Interface for input components that are used in an AI conversation.
Since:
25.3
Author:
Vaadin Ltd
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addSubmitListener(com.vaadin.flow.function.SerializableConsumer<String> listener)
    Adds a listener for submit events.
    default boolean
    Gets whether submitting input is disabled.
    default void
    setSubmitDisabled(boolean submitDisabled)
    Sets whether submitting input is disabled.
  • Method Details

    • addSubmitListener

      void addSubmitListener(com.vaadin.flow.function.SerializableConsumer<String> listener)
      Adds a listener for submit events.

      The listener is notified with the submitted value when the user submits input.

      Parameters:
      listener - the listener to add, not null
    • setSubmitDisabled

      default void setSubmitDisabled(boolean submitDisabled)
      Sets whether submitting input is disabled. While disabled, the user can still type, but cannot submit, and the typed text is kept.

      The AIOrchestrator disables submitting while it processes a request, and while a file is being uploaded to a file receiver that is an Upload or an UploadManager. During an upload, the browser shows this only when server push or polling is enabled. The orchestrator only enables submitting again if it disabled it, see isSubmitDisabled(). The default implementation does nothing.

      Disabling submitting while the orchestrator has it disabled, for example in a response listener, does not last: the orchestrator enables submitting when the request and the uploads have ended. To keep the user from sending more messages, disable the input component itself, for example with setEnabled(false) on a MessageInput, or reject the prompts in a request interceptor.

      Parameters:
      submitDisabled - true to disable submitting, false to enable it
      Since:
      25.4
    • isSubmitDisabled

      default boolean isSubmitDisabled()
      Gets whether submitting input is disabled.

      The AIOrchestrator leaves submitting disabled when it is already disabled, for example by the application, at the time the orchestrator would disable it. The default implementation returns false.

      Returns:
      true if submitting is disabled, false otherwise
      Since:
      25.4