Skip to content

AI

AiArtifactPartView

Bit.BlazorUI.AI

BitAiArtifactPartView is what a message shows where it introduced an artifact. The artifact belongs to the conversation rather than to the message, so the part only names it: the view looks it up in the conversation by its id and shows the shared BitAiArtifactView, opened at the version this turn produced - so a later revision never rewrites what an earlier turn appears to have said. An artifact the conversation does not hold (yet) is named by a placeholder tag rather than dropped, so the turn still says it produced one.

Notes

To use this component, you need to install the Bit.BlazorUI.AI(opens in a new tab) nuget package, as described in the Optional steps of the Getting started page.

BitAiArtifactPartView renders a BitAiArtifactView, so it needs what that needs: AddBitBlazorUIAIServices at startup. Inside a BitAiChat it is rendered for every artifact part of a message on its own, by the BitAiMessagePartView of the part, which hands it the session's conversation as its Conversation; a session adds the part to the message whose transport sent the BitAiArtifactCreatedEvent, stamped with the version it opened. The body of the panel is drawn by the artifact view, so a renderer registered for an artifact kind (BitAiRendererRegistry.RegisterArtifact, see AiArtifactView) draws it here too. See the Artifacts scenario for the whole chat.

Usage

Every example is live. Open its code to see exactly what produced the component running underneath.

Basic

Give it the Part of the message - a BitAiArtifactPart naming the artifact by its id - and the Conversation holding the artifact. The view finds it there and shows it in a panel.

Meeting notes

Meeting notes

  • Ship the AI components in the next release.

  • Owner: the UI team.

Versions per turn

A session stamps each artifact part with the version its turn produced (ArtifactVersion). The scripted transport here drafts a README on the first turn and revises the same artifact on the second: each turn's panel opens at its own version, while the version selector of either can show the other.



Missing artifacts

An artifact the conversation does not hold - no Conversation was given, the artifact was removed with the messages that referenced it, or it has not arrived yet - is named by a neutral placeholder tag, whose tooltip is the artifact id, so the turn still says it produced one.

Artifact


Artifact

Cascading parameters

BitParams with a BitAiArtifactPartViewParams sets the look of every artifact part view inside it - inside a chat, the artifacts of every message - here the header of the panel and the placeholder tag. The part and the conversation are not among them: they are what makes one view the one it is. It is a default, not an override: a view keeps what it sets itself (the last one sets Styles of its own, which replace the cascaded ones).

Meeting notes

Meeting notes

  • Ship the AI components in the next release.

  • Owner: the UI team.


Artifact


Meeting notes

Meeting notes

  • Ship the AI components in the next release.

  • Owner: the UI team.

Style & Class

Style and Class reach the root; Styles and Classes hand ArtifactView the class-styles of the panel and Placeholder those of the tag. The part has no variables of its own: the public --bit-AiArtifactView-* and --bit-Tag-* variables inherit, so set on the part's Style they restyle the panel or the tag inside it.

Meeting notes

Meeting notes

  • Ship the AI components in the next release.

  • Owner: the UI team.


Artifact


Meeting notes

Meeting notes

  • Ship the AI components in the next release.

  • Owner: the UI team.

RTL

In right-to-left text the panel and the placeholder read from the right, whether the direction comes from Dir or from a dir attribute around the view.

صورت جلسه

صورت جلسه

  • انتشار اجزای هوش مصنوعی در نسخه بعدی.

  • مسئول: تیم رابط کاربری.


Artifact

API

Every parameter, public member, sub-class and enum this component exposes.

BitAiArtifactPartView parameters

Name Type Default value Description
Classes BitAiArtifactPartViewClassStyles? null Custom CSS classes for different parts of the artifact part view.
Conversation BitAiConversation? null The conversation that holds the artifact, which the view finds it in by the id of the part (BitAiConversation.FindArtifact). While it is null, or holds no artifact of that id, the part is shown as a placeholder tag. The artifact is looked up each time the view's parameters are set, so one that arrives later is shown once the parent renders the view again; the panel then follows the artifact itself as it streams and is revised.
Part BitAiArtifactPart The part of the message that references the artifact (required): its ArtifactId names it and its ArtifactVersion is the version the panel opens at, the latest when it is null.
Styles BitAiArtifactPartViewClassStyles? null Custom CSS styles for different parts of the artifact part view.

BitComponentBase parameters

Name Type Default value Description
AriaLabel string? null Gets or sets the accessible label for the component, used by assistive technologies.
Class string? null Gets or sets the CSS class name(s) to apply to the rendered element.
Dir BitDir? null Gets or sets the text directionality for the component's content.
Disabled bool false Gets or sets a value indicating whether the component is disabled and cannot respond to user interaction.
ForceAnimation bool false Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested.
HtmlAttributes Dictionary<string, object> new Dictionary<string, object>() Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. An attribute written on the component wins over an entry of the same name.
Id string? null Gets or sets the unique identifier for the component's root element.
Style string? null Gets or sets the CSS style string to apply to the rendered element.
TabIndex string? null Gets or sets the tab order index for the component when navigating with the keyboard.
Visibility BitVisibility BitVisibility.Visible Gets or sets the visibility state (visible, hidden, or collapsed) of the component.

BitComponentBase public members

Name Type Default value Description
UniqueId Guid Guid.NewGuid() Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed.
RootElement ElementReference Gets the reference to the root HTML element associated with this component.

BitAiArtifactPartViewClassStyles properties

Name Type Default value Description
Root string? null Custom CSS classes/styles for the root element of the BitAiArtifactPartView.
ArtifactView BitAiArtifactViewClassStyles? null Custom CSS classes/styles for the BitAiArtifactView the BitAiArtifactPartView shows the artifact in.
Placeholder BitTagClassStyles? null Custom CSS classes/styles for the BitTag the BitAiArtifactPartView shows when the conversation does not hold the artifact.

BitAiArtifactPart properties

The part of a message that says it introduced an artifact. It holds no content of its own - the artifact is the conversation's - only which artifact, and at which version. A session adds one to the message whose transport opened the artifact (a BitAiArtifactCreatedEvent). Its Kind is BitAiMessagePartKinds.Artifact ("artifact"); like every part it also has a PartId, a Version and a Changed event (see AiMessagePartView).

Name Type Default value Description
new(artifactId, partId?) constructor Creates a reference to the artifact of that id; a null partId generates one.
ArtifactId string The id of the artifact in the conversation.
ArtifactVersion int? null The version of the artifact this turn introduced, which the panel opens at (the latest when it is null), so an older turn keeps showing what it produced. Settable: a session stamps it with the version the turn opened. Not to be confused with Version, which counts the changes of the part itself.

BitVisibility enum

Name Value Description
Visible 0 The content of the component is visible.
Hidden 1 The content of the component is hidden, but the space it takes on the page remains (visibility:hidden).
Collapsed 2 The component is hidden (display:none).

BitDir enum

Name Value Description
Ltr 0 Ltr (left to right) is to be used for languages that are written from the left to the right (like English).
Rtl 1 Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic).
Auto 2 Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element.

Feedback

Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.