$npx -y skills add DevExpress/agent-skills --skill devexpress-blazor-ai-chat--- name: devexpress-blazor-ai-chat description: Generate and configure DevExpress Blazor AI Chat (DxAIChat) — an AI-powered chat UI for Blazor apps. Use for building conversational assistants, integrating providers (OpenAI, Azure OpenAI, Ollama, or custom), configuring system
| 1 | # DevExpress Blazor AI Chat |
| 2 | |
| 3 | `DxAIChat` is an AI-powered conversational UI component compatible with major cloud AI providers (OpenAI, Azure OpenAI) and self-hosted models (Ollama). It runs in Blazor, .NET MAUI, WPF, and WinForms applications. The component operates on a BYOK (bring your own key) model — you supply the AI provider credentials; DevExpress does not bundle any LLM. |
| 4 | |
| 5 | > **Security**: Never hardcode AI provider keys, endpoints, or credentials in source code. Use environment variables, user secrets, or a secrets vault. |
| 6 | |
| 7 | ## When to Use This Skill |
| 8 | |
| 9 | - Add a conversational AI chat widget to a Blazor page |
| 10 | - Connect `DxAIChat` to Azure OpenAI, OpenAI, or Ollama |
| 11 | - Configure prompt suggestions (hint bubbles shown before the first message) |
| 12 | - Add a system prompt to give the AI model a persona or instructions |
| 13 | - Enable file attachments (PDF, images) for multimodal AI analysis |
| 14 | - Render AI responses with Markdown formatting |
| 15 | - Switch between multiple AI providers at runtime |
| 16 | - Implement tool/function calling from the AI model |
| 17 | - Save and load conversation history |
| 18 | - Integrate with AI agents and custom backends via `IChatResponseProvider` |
| 19 | |
| 20 | ## Prerequisites & Installation |
| 21 | |
| 22 | ### NuGet Packages |
| 23 | |
| 24 | | Package | Minimum Version | Purpose | |
| 25 | |---------|-----------------|--------| |
| 26 | | `DevExpress.AIIntegration.Blazor.Chat` | 26.1 | Core AI Chat component | |
| 27 | | `DevExpress.Blazor` | 26.1 | Required DevExpress Blazor base | |
| 28 | | `DevExpress.AIIntegration.Agents` | 26.1 | Agent-based `IChatResponseProvider` creation (`.AsAIAgent()`) | |
| 29 | | `Microsoft.Extensions.AI` | 9.7.1 | Required MEI abstraction layer | |
| 30 | | `Microsoft.Extensions.AI.OpenAI` | 9.7.1-preview.1.25365.4 | Azure OpenAI / OpenAI provider bridge | |
| 31 | | `Azure.AI.OpenAI` | 2.3.0 | Azure OpenAI SDK | |
| 32 | | `OpenAI` | 2.3.0 | OpenAI (non-Azure) SDK | |
| 33 | | `OllamaSharp` | — | Ollama self-hosted provider | |
| 34 | |
| 35 | ```bash |
| 36 | # Install from NuGet.org: |
| 37 | dotnet add package DevExpress.AIIntegration.Blazor.Chat |
| 38 | dotnet add package DevExpress.Blazor |
| 39 | ``` |
| 40 | |
| 41 | **Important**: Always use version **26.1** or later. `IChatResponseProvider` and `.AsIChatResponseProvider()` are not available in 25.2 or earlier. All DevExpress packages must use the same version. A valid DevExpress license is required. |
| 42 | |
| 43 | ### Namespace Quick Reference |
| 44 | |
| 45 | Use this table to resolve `using` directives without searching — copy the exact namespace for each type: |
| 46 | |
| 47 | | Type / Extension | Namespace | |
| 48 | |---|---| |
| 49 | | `DxAIChat`, `DxAIChatPromptSuggestion`, `DxAIChatFileUploadSettings`, `BlazorChatMessage`, `IAIChat`, `AIChatResource`, `IAIChatMessageContextItem` | `DevExpress.AIIntegration.Blazor.Chat` | |
| 50 | | `IChatResponseProvider`, `.AsIChatResponseProvider()`, `.AsIChatResponseProvider(ChatOptions)` | `DevExpress.AIIntegration.Chat` | |
| 51 | | `.AsAIAgent(instructions:)` | `DevExpress.AIIntegration.Agents` | |
| 52 | | `DxResourceManager`, `Themes`, `SizeMode` | `DevExpress.Blazor` | |
| 53 | | `IChatClient`, `ChatRole` | `Microsoft.Extensions.AI` | |
| 54 | | `AzureOpenAIClient` | `Azure.AI.OpenAI` | |
| 55 | | `ApiKeyCredential` | `System.ClientModel` | |
| 56 | | `OpenAIClient` | `OpenAI` | |
| 57 | | `AddDevExpressBlazor`, `AddDevExpressAI` | Extension methods — no explicit `using` needed; resolved from installed NuGet packages | |
| 58 | |
| 59 | ### Required Registration (all three steps must be present) |
| 60 | |
| 61 | **Program.cs** — register the AI provider, then DevExpress services (see BYOK Setup Guide below for provider details): |
| 62 | ```csharp |
| 63 | // Register the IChatClient — AddDevExpressAI() automatically creates the default IChatResponseProvider from it |
| 64 | builder.Services.AddChatClient(chatClient); |
| 65 | builder.Services.AddDevExpressBlazor(); |
| 66 | builder.Services.AddDevExpressAI(); |
| 67 | ``` |
| 68 | |
| 69 | > **v26.1 note**: `DevExpress.Blazor` no longer includes `options.BootstrapVersion` or `DevExpress.Blazor.BootstrapVersion`. Do not generate either API. |
| 70 | |
| 71 | > **Keyed providers only**: For multi-provider (runtime-switching) setups, skip `AddChatClient` and register each provider explicitly: `builder.Services.AddKeyedScoped<IChatResponseProv |