CleanCodeJN.GenericApis.Chat 1.0.1

dotnet add package CleanCodeJN.GenericApis.Chat --version 1.0.1
                    
NuGet\Install-Package CleanCodeJN.GenericApis.Chat -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CleanCodeJN.GenericApis.Chat" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CleanCodeJN.GenericApis.Chat" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="CleanCodeJN.GenericApis.Chat" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CleanCodeJN.GenericApis.Chat --version 1.0.1
                    
#r "nuget: CleanCodeJN.GenericApis.Chat, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CleanCodeJN.GenericApis.Chat@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CleanCodeJN.GenericApis.Chat&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=CleanCodeJN.GenericApis.Chat&version=1.0.1
                    
Install as a Cake Tool

💬 CleanCodeJN.GenericApis.Chat

A ready-made AI Chat UI for Blazor WebAssembly — drop-in /ai page with MudBlazor, SSE streaming, MCP tool discovery, and markdown rendering.

Installation

dotnet add package CleanCodeJN.GenericApis.Chat

Requires the backend package:

dotnet add package CleanCodeJN.GenericApis

Setup

1. Blazor WASM host project — Program.cs

builder.Services.AddCleanCodeJNWithAiChat(options =>
{
    options.BackendUrl   = "https://localhost:7132"; // your API backend
    options.Title        = "My AI Assistant";        // header title
    options.ShowToolCalls = false;                   // show/hide tool call cards
    options.BearerToken  = "...";                    // optional auth token
});

2. _Imports.razor

@using CleanCodeJN.GenericApis.Chat.Pages
@using CleanCodeJN.GenericApis.Chat.Extensions

3. Register the page route — App.razor / router config

The component AiChatPage is shipped inside the RCL. Add a route or redirect to /ai:

@inject NavigationManager Nav
@code {
    protected override void OnInitialized()
    {
        // auto-redirect on start
        if (Nav.Uri == Nav.BaseUri || Nav.Uri == Nav.BaseUri.TrimEnd('/'))
            Nav.NavigateTo("/ai", replace: true);
    }
}
@using MudBlazor
<MudThemeProvider IsDarkMode="true" Theme="_theme" />
<MudDialogProvider />
<MudSnackbarProvider />

@code {
    private readonly MudTheme _theme = new()
    {
        PaletteDark = new PaletteDark
        {
            Primary           = "#4CAF50",
            AppbarBackground  = "#0d1b2a",
            Background        = "#0a1520",
            Surface           = "#112233",
        }
    };
}

5. index.html — remove default loading spinner

Replace the default Blazor loading <div> with a plain dark placeholder so there is no flash on startup:

<div id="app" style="background:#0a1520; height:100vh;"></div>

Backend requirements

The backend must expose two endpoints (added automatically by CleanCodeJN.GenericApis):

Endpoint Method Description
/ai/chat POST SSE streaming chat with Anthropic + MCP tool execution
/mcp GET Returns available MCP tools as JSON

Enable them in your API Program.cs:

app.UseCleanCodeJNWithMinimalApis(); // REST endpoints → also registers /ai/chat
app.UseCleanCodeJNWithMcp();         // MCP tool discovery → /mcp

Backend appsettings.json:

{
  "AiProxy": {
    "AnthropicApiKey": "sk-ant-...",
    "Model":           "claude-opus-4-5",
    "MaxTokens":       8096,
    "SelfBaseUrl":     "https://localhost:7132"
  }
}

ChatOptions reference

Property Type Default Description
BackendUrl string "" Base URL of the backend API
Title string "AI Assistant" Title shown in the chat header
ShowToolCalls bool false Show/hide tool call detail cards in chat
BearerToken string null JWT / Bearer token forwarded on every chat request

Features

  • SSE streaming — responses appear token by token as they arrive from Claude
  • MCP tool sidebar — auto-discovers all tools from /mcp; click a chip to insert the tool name into the input
  • Collapsible sidebar — toggle the tools panel via the toolbar button
  • Markdown rendering — tables, code blocks, headings, and lists are rendered as styled HTML (powered by Markdig)
  • Splash screen — shown on first load when no messages exist; explains the assistant and provides example prompts
  • Dark CleanCodeJN theme — green-on-dark colour scheme matching the CleanCodeJN brand

License

MIT — github.com/decius999/CleanCodeJN-Generic-Apis

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 32 3/9/2026
1.0.0 32 3/9/2026

BugFix: Logo added.