Class AssistAction
java.lang.Object
javax.swing.AbstractAction
com.inductiveautomation.ignition.designer.ai.AssistAction
- All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action
The "Ask AI" action shared by
AssistButton (labeled panel button) and AssistToolbarButton (icon-only toolbar button). Usually built by EmbeddedAssistantBuilder.action() or its button terminals; hosts may also construct one by hand.
Either way it needs only a live DesignerAiContext, not a ready one: the action reads
DesignerAiContext.isReady() at construction, each bound button subscribes to DesignerAiContext.onReadyChange(Runnable) for as long as it is displayable, and the action renders itself
disabled (with an explanatory tooltip) whenever no provider and model are configured. A host can
therefore mount its button during Designer startup, before the catalog has loaded, and it enables
itself once configuration lands.
The action owns the popup lifecycle: at most one JidePopup per action instance, opened
adjacent to whichever bound button was clicked. Per-call-site state — popup ownership, embed
host, prompt assists — lives here so the buttons stay pure presentation. An open popup is bound
to its owner staying on screen and closes with it, so it cannot outlive the surface it edits.
- See Also:
-
Field Summary
Fields inherited from class AbstractAction
changeSupport, enabledFields inherited from interface Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON -
Constructor Summary
ConstructorsConstructorDescriptionAssistAction(DesignerAiContext ai, Agent.AgentFactory agentFactory, EmbedHost host, List<PromptAssist> promptAssists) -
Method Summary
Methods inherited from class AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
-
Constructor Details
-
AssistAction
public AssistAction(DesignerAiContext ai, Agent.AgentFactory agentFactory, EmbedHost host, List<PromptAssist> promptAssists) - Parameters:
ai- the resolved Designer AI context. Need not beready; the action tracks readiness itself.agentFactory- builds theAgentthat powers each model turn. Invoked when the harness asks for an agent (at least once per session), so it may return per-call state.host- the strategies the embedded assistant uses to talk to the surrounding UI. For text editors, build one viaEmbedHost.forTextEditor(TextlikeComponent)orEmbedHost.forTextEditorWithInsert(TextlikeComponent); otherwise compose viaEmbedHost.builder().promptAssists- assists that drive the in-prompt autocomplete popup. Pass an empty list to disable the popup entirely.
-
-
Method Details
-
actionPerformed
-