MeshWeaver.Blazor.Chat 2.5.0

dotnet add package MeshWeaver.Blazor.Chat --version 2.5.0
                    
NuGet\Install-Package MeshWeaver.Blazor.Chat -Version 2.5.0
                    
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="MeshWeaver.Blazor.Chat" Version="2.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MeshWeaver.Blazor.Chat" Version="2.5.0" />
                    
Directory.Packages.props
<PackageReference Include="MeshWeaver.Blazor.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 MeshWeaver.Blazor.Chat --version 2.5.0
                    
#r "nuget: MeshWeaver.Blazor.Chat, 2.5.0"
                    
#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 MeshWeaver.Blazor.Chat@2.5.0
                    
#: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=MeshWeaver.Blazor.Chat&version=2.5.0
                    
Install as a Cake Addin
#tool nuget:?package=MeshWeaver.Blazor.Chat&version=2.5.0
                    
Install as a Cake Tool

MeshWeaver.Blazor.Chat

A comprehensive Blazor chat component library for building interactive chat interfaces with AI integration support. This library provides a complete set of reusable chat UI components designed to work seamlessly with Microsoft.Extensions.AI and MeshWeaver's messaging system.

Features

  • 🎨 Modern UI Components - Beautiful, responsive chat interface components
  • 🤖 AI Agent Integration - Built-in support for AI agents and function calling
  • 📝 Markdown Support - Rich text rendering with markdown support
  • 🔍 Citation Support - Display and link to document citations
  • 📱 Responsive Design - Mobile-friendly chat interface
  • Real-time Updates - Live message updates and progress indicators
  • 📚 Chat History - Persistent conversation management
  • 🎯 Auto-scroll - Automatic scrolling to latest messages

Components

Core Chat Components

ChatMessageList

Displays a list of chat messages with automatic scrolling and progress indicators.

<ChatMessageList Messages="@messages" 
                 InProgressMessage="@currentMessage" 
                 NoMessagesContent="@emptyStateContent" />
ChatMessageItem

Renders individual chat messages with role-based styling and content formatting.

  • Supports user messages and AI assistant responses
  • Displays function calls and their execution status
  • Renders citations and references
  • Markdown content support
ChatInput

Interactive input component for sending messages with agent selection.

<ChatInput OnSend="@HandleMessageSent" 
           IsDisabled="@isProcessing" 
           Agents="@availableAgents" />
ChatHeader

Header component with new chat functionality.

<ChatHeader OnNewChat="@StartNewConversation" />
ChatHistorySelector

Sidebar component for managing conversation history.

<ChatHistorySelector SelectedConversationId="@currentConversationId"
                     OnConversationSelected="@LoadConversation" />
ChatCitation

Component for displaying document citations and references.

<ChatCitation File="@citation.File" 
              PageNumber="@citation.Page" 
              Quote="@citation.Quote" />

Installation

Add the package reference to your project:

<PackageReference Include="MeshWeaver.Blazor.Chat" Version="2.2.0" />

Dependencies

This library depends on:

  • Microsoft.AspNetCore.Components.Web
  • MeshWeaver.AI - AI integration and agent management
  • MeshWeaver.Blazor - Base Blazor components and utilities
  • MeshWeaver.Layout - Layout and UI abstractions
  • MeshWeaver.Messaging.Hub - Message routing and communication

Usage

Basic Chat Setup

  1. Add the component to your Blazor page:
@page "/chat"
@using MeshWeaver.Blazor.Chat
@using Microsoft.Extensions.AI

<div class="chat-container">
    <ChatHeader OnNewChat="@StartNewChat" />
    
    <ChatMessageList Messages="@Messages" 
                     InProgressMessage="@InProgressMessage" />
    
    <ChatInput OnSend="@SendMessage" 
               IsDisabled="@IsProcessing" 
               Agents="@AvailableAgents" />
</div>

@code {
    private List<ChatMessage> Messages = new();
    private ChatMessage? InProgressMessage;
    private bool IsProcessing;
    private List<IAgentDefinition> AvailableAgents = new();
    
    private async Task SendMessage(ChatMessage message)
    {
        Messages.Add(message);
        IsProcessing = true;
        
        // Process message with your AI service
        var response = await ProcessMessageAsync(message);
        
        Messages.Add(response);
        IsProcessing = false;
        StateHasChanged();
    }
    
    private void StartNewChat()
    {
        Messages.Clear();
        InProgressMessage = null;
    }
}
  1. Include the required CSS and JavaScript:

The components automatically load their required assets, including:

  • ChatMessageList.razor.js - Auto-scrolling behavior
  • ChatInput.razor.js - Input handling and agent selection
  • Component-specific CSS files for styling

Advanced Features

Agent Selection

The chat input supports agent selection with dropdown functionality:

<ChatInput OnSend="@SendMessage"
           Agents="@GetAvailableAgents()"
           OnAgentSelected="@HandleAgentSelection" />
Function Call Display

The message components automatically render function calls and their progress:

// Function calls are displayed with progress indicators
// and status updates automatically
Citation Support

Citations are automatically extracted and displayed:


<ChatCitation File="document.pdf" PageNumber="5" Quote="Relevant quote text" />

Styling

The components come with built-in CSS classes that can be customized:

  • .message-list-container - Main message container
  • .user-message - User message styling
  • .assistant-message - AI assistant message styling
  • .assistant-function - Function call display
  • .input-box - Chat input container
  • .chat-header-container - Header styling

You can override these styles in your application's CSS to match your design system.

Integration with MeshWeaver

This library is designed to work seamlessly with the broader MeshWeaver ecosystem:

  • Message Hub: Integrates with MeshWeaver.Messaging.Hub for real-time communication
  • AI Services: Works with MeshWeaver.AI for agent management and function calling
  • Layout System: Uses MeshWeaver.Layout for consistent UI patterns

Examples

Check out the MeshWeaver documentation and sample applications for complete implementation examples.

Contributing

This library is part of the MeshWeaver project. Please refer to the main project repository for contribution guidelines.

License

This project is licensed under the same terms as the main MeshWeaver project.

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
2.5.0 205 11/3/2025
2.4.0 191 10/2/2025
2.3.0 232 8/4/2025
2.2.0 525 7/21/2025