CEBot.Ai
1.0.0
dotnet add package CEBot.Ai --version 1.0.0
NuGet\Install-Package CEBot.Ai -Version 1.0.0
<PackageReference Include="CEBot.Ai" Version="1.0.0" />
<PackageVersion Include="CEBot.Ai" Version="1.0.0" />
<PackageReference Include="CEBot.Ai" />
paket add CEBot.Ai --version 1.0.0
#r "nuget: CEBot.Ai, 1.0.0"
#addin nuget:?package=CEBot.Ai&version=1.0.0
#tool nuget:?package=CEBot.Ai&version=1.0.0
CEBot.Ai
A cost-efficient, privacy-focused Razor Component for integrating AI chatbots into your Blazor Web Apps.
Overview
CEBot.Ai is a Razor Class Library (RCL) that enables AI-powered chatbot functionality for Blazor web applications. By leveraging Jan.AI’s server running on the user’s local machine, CEBot.Ai provides a secure, high-performance, and cost-efficient solution for integrating AI models into your applications.
This component is ideal for developers looking to: • Prioritize Privacy: AI models operate locally on the user’s machine, ensuring sensitive data never leaves their system. • Reduce Costs: Offload AI operations to users’ local resources, drastically reducing server costs for developers. • Maintain Flexibility: Supports multiple AI models and seamlessly integrates into Blazor web apps.
Features • Privacy-First: Keeps all data processing on the user’s local machine. • Cost-Efficient: Eliminates cloud hosting fees for AI operations. • Customizable: Configure the chatbot’s expertise and behavior using developer-provided parameters. • Interactive Blazor Support: Compatible with both InteractiveAuto and InteractiveWebAssembly render modes. • Flexible AI Models: Specify your preferred AI model, such as "llama3.2-3b-instruct".
Getting Started
Installation
Install the library from NuGet:
dotnet add package CEBot.Ai
Usage
Import the component in your Blazor app: @using CEBot.Ai.Components
In program.cs: (InteractiveAuto add to both program.cs. InteractiveWebassembly add to program.cs)
using FDP.CEBot.Ai.Services;
Make sure you have a HttpClient: builder.Services.AddScoped(sp ⇒ new HttpClient { BaseAddress = new Uri("http://localhost:1337/") });
Make sure you add CEBot service: builder.Services.AddScoped<CEBotService>();
Add the CEBot component to your page: <CEBot SystemContent="Define your AI expert context here" AiModel="llama3.2-3b-instruct" UserData="Provide additional data for the AI model here" />
Parameters:
SystemContent string Defines the context or expertise of the AI agent.
AiModel string Specifies the AI model to use (e.g., "llama3.2-3b-instruct"). (NOTE: as of now, only llama3.2-3b-instruct is used. change this param doesn't change the model)
UserData string Data passed from your application to the AI model for customized behavior.
Example Here’s an example of a basic AI chatbot integration:
<CEBot SystemContent="You are a financial advisor expert in long-term investments." AiModel="llama3.2-3b-instruct" UserData="@JsonSerializer.Serialize(new { userPortfolio = portfolioData })" />
Expected Output
The component will provide a responsive chatbot interface for users to engage in back-and-forth conversations with the AI agent.
Sample page: (this uses MudBlazor for UI)
@page "/cebot/demo"
@using FDP.CEBot.Ai.Components @using FDP.CEBot.Ai.Data @using System.Text.Json
<MudContainer class="my-8 py-8 px-4" MaxWidth="MaxWidth.Large"> <MudText Class="my-4" Align="Align.Center" Typo="Typo.h2">CEBot.Ai Demo (Experimental) </MudText>
<MudDivider Class="my-16" />
<CEBot systemContent=@systemContent aiModel=@aiModel userData=@userDataStr/>
</MudContainer>
@code{
public string systemContent {get;set;} = "You are a useful AI assistant. When a user asks Apple, you respond with Orange.";
public string aiModel {get;set;} = "llama3.2-3b-instruct";
public string userDataStr {get;set;} = "";
public class Person {
public string Name {get;set;} = "";
public int Age {get;set;} = 0;
}
protected override async Task OnInitializedAsync()
{
List<Person> People = new List<Person>(){
new Person(){Name = "Jason", Age = 44}
};
var contextData = new
{
People = People
};
// Serialize to JSON
userDataStr = JsonSerializer.Serialize(contextData);
}
}
Requirements • Jan.AI Server: Ensure Jan.AI’s server is running locally on the user’s machine to host the AI model. • Blazor Framework: Designed for Blazor Server and WebAssembly applications.
Key Benefits 1. Privacy: User data is processed locally, ensuring compliance with data protection regulations. 2. Performance: Leverages the computing power of the user’s machine for seamless interactions. 3. Scalability: Developers can serve unlimited users without incurring additional server costs.
Technical Details • Framework: .NET 9+ • Supported Render Modes: • InteractiveAuto • InteractiveWebAssembly • Dependency: Requires Jan.AI or similar server that hosts OpenAI-compatible models locally.
Contributing
Contributions are welcome! If you have suggestions, feature requests, or bug reports, feel free to open an issue
License
This project is licensed under the MIT License.
Product | Versions 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. |
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 9.0.0)
- Microsoft.Extensions.Http (>= 9.0.0)
- MudBlazor (>= 7.15.0)
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.0 | 76 | 1/9/2025 |
Initial release with support for AI chatbot integration, including Jan.AI server compatibility and customizable parameters.