-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[Agent Builder] Attachment inline rendering and UI actions #253913
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
chrisbmar
merged 10 commits into
elastic:main
from
chrisbmar:ab-attachment-inline-rendering-clean
Feb 19, 2026
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8156bff
define render attachment xml element server side
chrisbmar f7f5ed4
update attachment ui definition interface with new methods
chrisbmar 3575341
markdown plugin initial implementation
chrisbmar 94e015f
wire up markdown plugin with dependencies
chrisbmar 5b89a2a
implement attachment with actions base logic
chrisbmar 061c6dc
rename file
chrisbmar 67eb2b5
remove console logs
chrisbmar 52470d0
update action button contract to include an icon
chrisbmar 806ae0c
revert prompt changes for now
chrisbmar 42eef38
Merge branch 'main' into ab-attachment-inline-rendering-clean
chrisbmar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...n/components/conversations/conversation_rounds/round_response/attachment_with_actions.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /* | ||
| * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
| * or more contributor license agreements. Licensed under the Elastic License | ||
| * 2.0; you may not use this file except in compliance with the Elastic License | ||
| * 2.0. | ||
| */ | ||
|
|
||
| import React from 'react'; | ||
| import type { UnknownAttachment } from '@kbn/agent-builder-common/attachments'; | ||
| import { EuiButton } from '@elastic/eui'; | ||
| import { AGENT_BUILDER_EXPERIMENTAL_FEATURES_SETTING_ID } from '@kbn/management-settings-ids'; | ||
| import type { AttachmentsService } from '../../../../../services/attachments/attachements_service'; | ||
| import { useKibana } from '../../../../hooks/use_kibana'; | ||
|
|
||
| interface AttachmentWithActionsProps { | ||
| attachment: UnknownAttachment; | ||
| attachmentsService: AttachmentsService; | ||
| isSidebar: boolean; | ||
| conversationId: string; | ||
| } | ||
|
|
||
| /** | ||
| * Component that renders an attachment with its action buttons. | ||
| */ | ||
| export const AttachmentWithActions: React.FC<AttachmentWithActionsProps> = ({ | ||
| attachment, | ||
| attachmentsService, | ||
| isSidebar, | ||
| conversationId, | ||
| }) => { | ||
| const { | ||
| services: { settings }, | ||
| } = useKibana(); | ||
| const isExperimentalFeaturesEnabled = settings?.client.get<boolean>( | ||
| AGENT_BUILDER_EXPERIMENTAL_FEATURES_SETTING_ID, | ||
| false | ||
| ); | ||
|
|
||
| if (isExperimentalFeaturesEnabled === false) { | ||
| return null; | ||
| } | ||
|
|
||
| const uiDefinition = attachmentsService.getAttachmentUiDefinition(attachment.type); | ||
|
|
||
| if (!uiDefinition) { | ||
| return null; | ||
| } | ||
|
|
||
| const actionButtons = uiDefinition.getActionButtons?.({ | ||
| attachment, | ||
| isSidebar, | ||
| updateOrigin: async (originId: string) => { | ||
| // TODO: Implement updateOrigin | ||
| // attachmentsService.updateOrigin(conversationId, attachment.id, originId); | ||
| }, | ||
| }); | ||
|
|
||
| return ( | ||
| <> | ||
| {actionButtons?.map((button) => ( | ||
| <EuiButton key={button.label} onClick={button.handler}> | ||
| {button.label} | ||
| </EuiButton> | ||
| ))} | ||
| {uiDefinition?.renderContent?.({ attachment, isSidebar })} | ||
| </> | ||
| ); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not blocking but we should consider pushing this up into agentBuilderServices hook
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we technically don't even need it considering the agent doesn't have any prompt to emit the custom XML tag... so I could remove it for now? This was basically just a guard in case the agent emitted the custom XML tag for attachment_renderer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeh we can remove for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
waiting forever for CI to pass, so will merge this PR as is once CI is done and in the canvas-mode PR I'll remove this check 🙏🏽