AugusteVN.Modules.VirtualAssistant._Shared.Spa
1.0.2
dotnet add package AugusteVN.Modules.VirtualAssistant._Shared.Spa --version 1.0.2
NuGet\Install-Package AugusteVN.Modules.VirtualAssistant._Shared.Spa -Version 1.0.2
<PackageReference Include="AugusteVN.Modules.VirtualAssistant._Shared.Spa" Version="1.0.2" />
<PackageVersion Include="AugusteVN.Modules.VirtualAssistant._Shared.Spa" Version="1.0.2" />
<PackageReference Include="AugusteVN.Modules.VirtualAssistant._Shared.Spa" />
paket add AugusteVN.Modules.VirtualAssistant._Shared.Spa --version 1.0.2
#r "nuget: AugusteVN.Modules.VirtualAssistant._Shared.Spa, 1.0.2"
#:package AugusteVN.Modules.VirtualAssistant._Shared.Spa@1.0.2
#addin nuget:?package=AugusteVN.Modules.VirtualAssistant._Shared.Spa&version=1.0.2
#tool nuget:?package=AugusteVN.Modules.VirtualAssistant._Shared.Spa&version=1.0.2
AugusteVN.Modules.VirtualAssistant._Shared.Spa
Blazor components, state management, and Ollama HTTP client for the VirtualAssistant module — provides a full chat-style interface for local LLM inference.
Part of the AugusteVN Modules collection.
Overview
This is a client-side-only module with no server-side Api, Database, or Features projects. It integrates directly with a local Ollama instance via AugusteVN.Ollama.Client for real-time streaming text generation.
Extension Method
AddVirtualAssistantSharedSpa(this IServiceCollection, IConfiguration)
Registers the VirtualAssistant SPA layer:
OllamaClientConfig— Binds configuration fromappsettings.jsonviaIOptions<OllamaClientConfig>HttpClient— StandardIHttpClientFactoryregistrationVirtualAssistantState— Scoped reactive state provider (extendsStateProviderwithPersistentComponentState)OllamaHttpClient— Scoped Ollama API client fromAugusteVN.Ollama.ClientIVirtualAssistantClient— Scoped asVirtualAssistantHttpClient, the module's primary client abstraction
// Program.cs
builder.Services.AddVirtualAssistantSharedSpa(builder.Configuration);
Dependencies
AugusteVN.Ollama.Client— Ollama REST API client for model listing and text generation
Services
VirtualAssistantState
Reactive state provider (StateProvider) with PersistentComponentState support for server prerendering:
| Property | Type | Description |
|---|---|---|
Models |
List<ModelResponse>? |
Cached list of locally available Ollama models |
Response |
GenerateResponse? |
Current/latest response (notifies on change) |
ResponseHistory |
List<GenerateResponse> |
Full history of all generated responses |
SelectedResponse |
GenerateResponse? |
Currently selected response from history (notifies on change) |
ResponsePreview |
string? |
HTML preview of the current response (Markdown converted) |
SelectedModel |
string? |
Currently selected model name |
HostUrl |
string? |
Current Ollama host URL |
IsPreviewModeOn |
bool |
Toggle for Markdown preview mode (notifies on change) |
Methods:
SetSelectedResponse(GenerateResponse)— Sets bothSelectedResponseandResponsesimultaneously
IVirtualAssistantClient
Abstraction for the VirtualAssistant HTTP operations:
| Method | Description |
|---|---|
GetModelsAsync(hostUrl) |
Fetches locally available Ollama models |
GenerateResponseAsync(request) |
Streams a text generation response |
VirtualAssistantHttpClient
Implementation of IVirtualAssistantClient backed by OllamaHttpClient:
GetModelsAsync— CallsListLocalModelsAsyncon the Ollama client, caches results in state keyed byHostUrlGenerateResponseAsync— Streams generation viaOllamaGenerateRequest, accumulates tokens intoGenerateResponse.Response, capturesContextandCompletedAton completion, and appends toResponseHistory
OllamaHttpClient
Direct Ollama REST API client from AugusteVN.Ollama.Client, registered as a scoped service.
Components
VirtualAssistantPromptForm
Full prompt submission form with:
- Host URL input with blur-triggered model list loading
- Default host URL shortcut (
http://localhost:11434) - Model selector dropdown (populated from Ollama local models)
- Prompt textarea with full-screen toggle
- Preview mode on/off switch
- FluentValidation integration
- Submit button disabled during generation or when required fields are empty
| Parameter | Type | Description |
|---|---|---|
IsFullScreen |
bool |
Whether to render in expanded full-screen mode |
VirtualAssistantPreview
Reactive Markdown-to-HTML response preview. Listens to VirtualAssistantState changes and renders the response as:
- Edit mode — Raw Markdown in a
<textarea>for editing - Preview mode — HTML rendered via
Markdown.ToHtmlwith Prism.js syntax highlighting
Toggles visibility based on State.IsPreviewModeOn.
| Parameter | Type | Description |
|---|---|---|
IsFullScreen |
bool |
Whether to render with expanded height |
VirtualAssistantStateChangeListener
Internal component that bridges INotifyPropertyChanged events from VirtualAssistantState to Blazor's rendering lifecycle. Listens for Response and IsPreviewModeOn property changes and invokes OnPreviewChanged.
VirtualAssistantPromptHistory
Renders the full response history as a scrollable list with:
- Prompt text (truncated) and completion timestamp for each response
- Click to select and view a previous response
- Copy to clipboard button (copies prompt + response)
- Download as Markdown file button (generates
.mdfile with slugified filename)
Registration
// Program.cs
builder.Services.AddVirtualAssistantSharedSpa(builder.Configuration);
Configuration
{
"OllamaClientConfig": {
"BaseUrl": "http://localhost:11434"
}
}
Installation
dotnet add package AugusteVN.Modules.VirtualAssistant._Shared.Spa
Full Documentation
See the VirtualAssistant Module README for complete documentation.
| Product | Versions 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. |
-
net10.0
- AugusteVN._Shared.Extensions (>= 1.1.1)
- AugusteVN.Modules.VirtualAssistant._Shared (>= 1.0.2)
- AugusteVN.Ollama.Client (>= 1.2.0)
- AugusteVN.Razor.PrismJS (>= 1.1.7)
- AugusteVN.Razor.State (>= 1.2.0)
- AugusteVN.ResultPattern.Contracts (>= 1.1.0)
- Blazored.FluentValidation (>= 2.2.0)
- Mapster (>= 10.0.10)
- Markdig (>= 0.40.0)
- Microsoft.AspNetCore.Components.Web (>= 10.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.