Class AiMessageRegenerateAction
- All Implemented Interfaces:
TargetAction<AiChat<?>>,Action,HasShortcutCombination
The prompt is the nearest AiMessageRole.USER message at or
before the clicked one, which is why the same action serves both roles: under an assistant
message it re-asks the question that message answers, under a user message it re-asks that
message.
Rewinding needs the message source, which only AiChat has, so the action is a
TargetAction: the chat wires itself as the target when the action is assigned to
one of its roles. Assigned to a standalone AiMessageList
it has no target and execute(io.jmix.aichat.action.AiMessageActionPerformedEvent) throws.
Like AiMessageCopyAction it carries no icon component — the glyph comes from CSS
through the jmix-ai-message-action-regenerate class and the
--jmix-ai-message-icon-regenerate mask — and its description is localized from the
message bundle through an injected Messages, so an instance built with new
rather than through the registry carries none.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe action type id, for<action type="aichat_messageRegenerate"/>in a descriptor.static final StringThe class name applied to the rendered button, so the action can be styled per theme.protected @Nullable AiChat<?> Fields inherited from class io.jmix.aichat.action.AiMessageAction
classNamesFields inherited from class io.jmix.flowui.kit.action.AbstractAction
description, enabled, eventBus, icon, id, shortcutCombination, text, variant, visibleFields inherited from interface io.jmix.flowui.kit.action.Action
PROP_DESCRIPTION, PROP_ENABLED, PROP_ICON, PROP_SHORTCUT_COMBINATION, PROP_TEXT, PROP_VARIANT, PROP_VISIBLE -
Constructor Summary
ConstructorsConstructorDescriptionCreates the action with the default idID.Creates the action with the given id. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidBusiness logic of the action.@Nullable AiChat<?> protected voidHook for subclasses to set defaults (icon, description, class names).protected voidsetMessages(Messages messages) voidMethods inherited from class io.jmix.aichat.action.AiMessageAction
actionPerform, actionPerform, addActionPerformedListener, addClassNames, getClassNames, refreshState, self, setEnabled, setShortcutCombination, setText, setVariant, setVisible, unsupported, withClassNames, withDescription, withHandler, withIconMethods inherited from class io.jmix.flowui.kit.action.AbstractAction
addPropertyChangeListener, firePropertyChange, getDescription, getEventBus, getIcon, getIconComponent, getId, getShortcutCombination, getText, getVariant, hasListener, isEnabled, isVisible, setDescription, setIcon, setIconComponentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.jmix.flowui.kit.action.Action
actionPerform, addPropertyChangeListener, getDescription, getIcon, getIconComponent, getId, getText, getVariant, isEnabled, isVisible, refreshState, setDescription, setEnabled, setIcon, setIconComponent, setText, setVariant, setVisibleMethods inherited from interface io.jmix.flowui.kit.component.HasShortcutCombination
getShortcutCombination, setShortcutCombination
-
Field Details
-
ID
The action type id, for<action type="aichat_messageRegenerate"/>in a descriptor.- See Also:
-
REGENERATE_CLASS_NAME
The class name applied to the rendered button, so the action can be styled per theme.- See Also:
-
target
-
-
Constructor Details
-
AiMessageRegenerateAction
public AiMessageRegenerateAction()Creates the action with the default idID. -
AiMessageRegenerateAction
Creates the action with the given id.- Parameters:
id- the action id
-
-
Method Details
-
initAction
protected void initAction()Description copied from class:AiMessageActionHook for subclasses to set defaults (icon, description, class names). Empty by default.Called from the constructor, so it runs before the subclass's own field initializers: set state through the inherited setters, not through subclass fields.
- Overrides:
initActionin classAiMessageAction<AiMessageRegenerateAction>
-
getTarget
- Specified by:
getTargetin interfaceTargetAction<AiChat<?>>
-
setTarget
- Specified by:
setTargetin interfaceTargetAction<AiChat<?>>
-
execute
Description copied from class:AiMessageActionBusiness logic of the action. Empty by default.- Overrides:
executein classAiMessageAction<AiMessageRegenerateAction>- Parameters:
event- the performed event, carrying the rendered item, the domain message it was rendered from, and the host list
-
setMessages
-