### Setup OpenAI Assistant in Blazor Source: https://github.com/devexpress/blazor/blob/25.2/demo/BlazorDemo.Wasm/BlazorDemo/DataSources/ChatResources/dxaichat.md Shows how to connect the DevExpress AI Chat component to an existing OpenAI Assistant. Pass the assistant and thread IDs to the SetupAssistantAsync method to initiate tasks within a single application. ```C# // Assuming 'chat' is an instance of IAIChat await chat.SetupAssistantAsync("YourAssistantId", "YourThreadId"); ``` -------------------------------- ### Load Initial Messages in DxAIChat Source: https://github.com/devexpress/blazor/blob/25.2/demo/BlazorDemo.ServerSide/BlazorDemo/DataSources/ChatResources/dxaichat.md Initializes the DxAIChat component and loads a predefined message when the chat is initialized. This is useful for starting a conversation with a greeting or context. ```Razor @code { void ChatInitialized(IAIChat chat) { chat.LoadMessages(new[] { new BlazorChatMessage(Microsoft.Extensions.AI.ChatRole.Assistant, "Hello, how can I help you?") }); } } ``` -------------------------------- ### Setup AI Assistant with IDs Source: https://github.com/devexpress/blazor/blob/25.2/demo/BlazorDemo.ServerSide/BlazorDemo/DataSources/ChatResources/dxaichat.md Connects the DxAIChat component to an existing OpenAI Assistant by providing the assistant and thread IDs. This allows the chat to leverage a pre-configured AI assistant for its tasks. ```C# await chat.SetupAssistantAsync(assistantId, threadId); ``` -------------------------------- ### Getting Filter Criteria Source: https://github.com/devexpress/blazor/blob/25.2/demo/BlazorDemo.Wasm/BlazorDemo/Pages/TreeList/Filtering/Descriptions/TreeList-Filtering-FilterAPI.md Retrieve the currently applied filter criteria for the entire TreeList or for a specific field. ```APIDOC ## GetFilterCriteria ### Description Retrieves the criteria operator that is currently applied to the entire TreeList. ### Method `GetFilterCriteria()` ### Parameters None ### Response #### Success Response (200) - **CriteriaOperator** (CriteriaOperator) - The criteria operator applied to the TreeList. ``` ```APIDOC ## GetFieldFilterCriteria ### Description Retrieves the criteria operator that is currently applied to a specified data field. ### Method `GetFieldFilterCriteria(string fieldName)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **fieldName** (string) - Required - The name of the data field for which to retrieve the filter criteria. ### Response #### Success Response (200) - **CriteriaOperator** (CriteriaOperator) - The criteria operator applied to the specified data field. ``` -------------------------------- ### Getting Filter Criteria Source: https://github.com/devexpress/blazor/blob/25.2/demo/BlazorDemo.ServerSide/BlazorDemo/Pages/TreeList/Filtering/Descriptions/TreeList-Filtering-FilterAPI.md Retrieve the currently applied filter criteria for the TreeList or a specific field using the `GetFilterCriteria` and `GetFieldFilterCriteria` methods. ```APIDOC ## GetFilterCriteria ### Description Retrieves the criteria operator currently applied to the entire TreeList. ### Method `GetFilterCriteria() : CriteriaOperator` ### Returns - **CriteriaOperator** - The criteria operator applied to the TreeList. ``` ```APIDOC ## GetFieldFilterCriteria ### Description Retrieves the criteria operator currently applied to a specified data field. ### Method `GetFieldFilterCriteria(string fieldName) : CriteriaOperator` ### Parameters - **fieldName** (string) - Required - The name of the data field to retrieve the filter criteria for. ### Returns - **CriteriaOperator** - The criteria operator applied to the specified data field. ``` -------------------------------- ### Window Footer Configuration Source: https://github.com/devexpress/blazor/blob/25.2/demo/BlazorDemo.Wasm/BlazorDemo/Pages/DialogsAndWindows/Window/Descriptions/DialogsAndWindows-Window-Overview.md Configure the visibility of the window's footer by setting the `ShowFooter` property. ```APIDOC ## Window Footer ### Description Control the display of the footer section within the `DxWindow`. ### Properties - **ShowFooter** (bool) - Set to `true` to display the footer, `false` to hide it (default). ### Example ```csharp ``` ``` -------------------------------- ### Register AI Chat Clients Source: https://github.com/devexpress/blazor/blob/25.2/demo/BlazorDemo.ServerSide/BlazorDemo/DataSources/ChatResources/dxaichat.md Register AI chat clients in the application's entry point. Use `AddChatClient` for a default client and `AddKeyedChatClient` for named clients to support multiple AI models. ```csharp public class Program { public static void Main(string[] args) { var builder = WebApplication.CreateBuilder(args); /* define chat clients */ builder.Services.AddChatClient(azureOpenAIChatClient); builder.Services.AddKeyedChatClient("Gemini", geminiChatClient); builder.Services.AddKeyedChatClient("Ollama", ollamaChatClient); /* ... */ } } ``` -------------------------------- ### Customize DxAIChat Message Appearance with Razor Source: https://github.com/devexpress/blazor/blob/25.2/demo/BlazorDemo.ServerSide/BlazorDemo/DataSources/ChatResources/dxaichat.md Use MessageContentTemplate to customize the rendering of message bubbles in the DxAIChat component. This example shows how to apply Markdown rendering to message content. ```Razor
@(new MarkupString(Markdig.Markdown.ToHtml(context.Content).Trim()))
@code { void ChatInitialized(IAIChat chat) { chat.LoadMessages(new[] { new BlazorChatMessage(Microsoft.Extensions.AI.ChatRole.User, "Hello, AI!"), new BlazorChatMessage(Microsoft.Extensions.AI.ChatRole.Assistant, "Hey there, human! What's on your mind? 😊") }); } } ``` ```CSS .demo-chat { width: 100%; height: 400px; } .demo-chat .demo-chat-content > p:last-child { margin-bottom: 0; } ```