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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BackgroundWorkerprotected AiToolsFlowuiPropertiesprotected AiChatServiceprotected AiChatMessageService -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidpublishUiStatusUpdate(TaskLifeCycle<AiToolStatusUpdate> taskLifeCycle, AiToolStatusUpdate statusUpdate) voidrun(View<?> owner, AiConversation conversation, AiChatMessage savedUserMessage, Consumer<AiToolStatusUpdate> progressHandler, Consumer<AiChatMessage> doneHandler, Runnable failureHandler) Submits an LLM call forsavedUserMessageon a background task.
-
Field Details
-
userAiMessageService
-
userAiChatService
-
backgroundWorker
-
properties
-
-
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 forsavedUserMessageon 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 tosavedUserMessage- already-persisted user message to answerprogressHandler- receives ephemeral status updates as they stream indoneHandler- receives the final assistant message when the call completesfailureHandler- invoked on error or timeout
-
publishUiStatusUpdate
protected void publishUiStatusUpdate(TaskLifeCycle<AiToolStatusUpdate> taskLifeCycle, AiToolStatusUpdate statusUpdate)
-