Class AssistantResponseTaskCoordinator

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

@Component("aitls_AssistantResponseTaskCoordinator") public class AssistantResponseTaskCoordinator extends Object
Runs the LLM call for a freshly persisted user AiChatMessage on a background task that streams ephemeral status updates and reports the final assistant AiChatMessage back to the UI.

Mirrors the CRM coordinator but invokes the add-on's AiChatService directly instead of going through a project-specific analytics service.

  • Field Details

  • Constructor Details

    • AssistantResponseTaskCoordinator

      public AssistantResponseTaskCoordinator()
  • Method Details

    • run

      public void run(View<?> owner, AiConversation conversation, AiChatMessage savedUserMessage, Consumer<AiToolStatusUpdate> progressHandler, Consumer<AiChatMessage> doneHandler, Runnable failureHandler)
      Submits an LLM call for savedUserMessage on a background task.
      Parameters:
      owner - view hosting the chat; scopes the task lifecycle (the task is cancelled when it detaches)
      conversation - conversation the message belongs to
      savedUserMessage - already-persisted user message to answer
      progressHandler - receives ephemeral status updates as they stream in
      doneHandler - receives the final assistant message when the call completes
      failureHandler - invoked on error or timeout
    • publishUiStatusUpdate

      protected void publishUiStatusUpdate(TaskLifeCycle<AiToolStatusUpdate> taskLifeCycle, AiToolStatusUpdate statusUpdate)