Record Class EmbedHost
java.lang.Object
java.lang.Record
com.inductiveautomation.ignition.designer.ai.embed.EmbedHost
- Record Components:
composer- turns each user submission plus host state into the message body sent to the agent.rendererFactory- builds the per-sessionReplyRenderer; receives a runnable the renderer fires after a successful host write-back so mounters (e.g. the popup-anchored trigger) can react.
public record EmbedHost(PromptComposer composer, ReplyRendererFactory rendererFactory)
extends Record
Host-side strategies an embedded AI assistant uses to talk to its surrounding UI: how to turn
each user submission into a message body and how to render replies into the suggestion card. Pass
an
EmbedHost to EmbeddedAssistantBuilder.host(EmbedHost) to wire up
a session. Non-text hosts compose one via builder() (or the assistant builder's
host(Consumer) overload) with their own composer/renderer; text-editor hosts can build a
standard one via forTextEditor(TextlikeComponent) or forTextEditorWithInsert(TextlikeComponent).-
Constructor Summary
ConstructorsConstructorDescriptionEmbedHost(PromptComposer composer, ReplyRendererFactory rendererFactory) Creates an instance of aEmbedHostrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic EmbedHostBuilderbuilder()composer()Returns the value of thecomposerrecord component.final booleanIndicates whether some other object is "equal to" this one.static EmbedHostforTextEditor(TextlikeComponent component) Builds a replace-only host for a text-editor component.static EmbedHostforTextEditorWithInsert(TextlikeComponent component) Variant offorTextEditor(TextlikeComponent)that adds a secondary Insert button to the suggestion card.final inthashCode()Returns a hash code value for this object.Returns the value of therendererFactoryrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
EmbedHost
Creates an instance of aEmbedHostrecord class.- Parameters:
composer- the value for thecomposerrecord componentrendererFactory- the value for therendererFactoryrecord component
-
-
Method Details
-
builder
- Returns:
- a fluent builder for a host with a custom composer and renderer. Prefer
forTextEditor(TextlikeComponent)/forTextEditorWithInsert(TextlikeComponent)for plain text editors.
-
forTextEditor
Builds a replace-only host for a text-editor component. The composer wraps the editor's snapshot in<editor>/<selection>blocks; the reply renderer's Replace button overwrites the host buffer viaTextlikeComponent.setText(String). Suited to small editors (single-statement expressions, short bindings) where the buffer is the unit of work.- Parameters:
component- the editor wrapper. Must expose a non-nullTextlikeComponent.getEditorState(); verified eagerly so wrappers likeTextLikeComboBoxfail at hook-up rather than at the first user submit.- Throws:
IllegalArgumentException- ifcomponentdoesn't expose an editor state snapshot.
-
forTextEditorWithInsert
Variant offorTextEditor(TextlikeComponent)that adds a secondary Insert button to the suggestion card. The button writes back throughTextlikeComponent.insert(String), dropping the suggested code at the host's caret (replacing any active selection). Suited to multi-line script editors where users routinely splice suggestions into existing code rather than wholesale-replacing the buffer.- Parameters:
component- the editor wrapper. Same shape requirement asforTextEditor(TextlikeComponent).- Throws:
IllegalArgumentException- ifcomponentdoesn't expose an editor state snapshot.
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
composer
-
rendererFactory
Returns the value of therendererFactoryrecord component.- Returns:
- the value of the
rendererFactoryrecord component
-