DxAIChatFileUploadSettings Class
Contains file upload settings for the DxAIChat component.
Namespace: DevExpress.AIIntegration.Blazor.Chat
Assembly: DevExpress.AIIntegration.Blazor.Chat.v25.1.dll
NuGet Package: DevExpress.AIIntegration.Blazor.Chat
Declaration
public class DxAIChatFileUploadSettings :
ComponentBase,
IDisposable,
IFileUploadSettings
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 attached files. To configure validation rules, declare a DxAIChatFileUploadSettings
object in AIChatSettings component markup and specify the following properties as needs dictate:
- AllowedFileExtensions
- Specifies file extensions the AI Chat component can upload.
- FileTypeFilter
- Specifies MIME types users can select in the Open File dialog.
- MaxFileCount
- Specifies the maximum number of files that users can attach to a message.
- MaxFileSize
- Specifies the maximum file size in bytes.
If validation fails, the component displays the corresponding error messages:
Note
The DevExpress Blazor AI Chat component only facilitates the file upload. It does not process or analyze the file’s content. The ability to interpret a specific file format depends entirely on the capabilities of the connected AI model.
See the AIChatUploadFileInfo class description for details.
Example
The following code snippet activates the file upload functionality in Blazor AI Chat and configures validation rules for uploaded files:
@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>