Back to Devexpress

DxAIChat.FileUploadEnabled Property

blazor-devexpress-dot-aiintegration-dot-blazor-dot-chat-dot-dxaichat-3b55d175.md

latest2.7 KB
Original Source

DxAIChat.FileUploadEnabled Property

Specifies whether users can attach files to messages.

Namespace : DevExpress.AIIntegration.Blazor.Chat

Assembly : DevExpress.AIIntegration.Blazor.Chat.v25.2.dll

NuGet Package : DevExpress.AIIntegration.Blazor.Chat

Declaration

csharp
[Parameter]
public bool FileUploadEnabled { get; set; }

Property Value

TypeDescription
Boolean

true to enable file upload operations; otherwise, false.

|

Remarks

Blazor AI Chat allows users to attach files when sending messages to the chat. Set the DxAIChat.FileUploadEnabled property to true to enable file upload operations.

Once a user attaches files to a message, the AI Chat component validates uploaded files. To configure validation rules, declare a DxAIChatFileUploadSettings object in AIChatSettings component markup and specify the following properties:

AllowedFileExtensionsSpecifies file extensions the AI Chat component can upload.MaxFileCountSpecifies the maximum number of files that users can attach to a message.MaxFileSizeSpecifies the maximum file size in bytes.

Example

The following code snippet activates the file upload functionality in Blazor AI Chat and configures validation rules for uploaded files:

razor
@using DevExpress.AIIntegration.Blazor.Chat

<DxAIChat CssClass="demo-chat"
          FileUploadEnabled="true">
    <AIChatSettings>
        <DxAIChatFileUploadSettings MaxFileCount="2"
                                    MaxFileSize="20000"
                                    AllowedFileExtensions="@(new List<string> { ".jpg", ".pdf" })"
                                    FileTypeFilter="@(new List<string> { "image/*", "application/pdf"})" />
    </AIChatSettings>
</DxAIChat>

Run Demo: AI Chat - File Attachments

See Also

DxAIChat Class

DxAIChat Members

DevExpress.AIIntegration.Blazor.Chat Namespace