MentorAgent Docs
Menu

Questa pagina non è ancora tradotta in italiano: qui la trovi in inglese.

ReferencePackage: Novior.MentorAgent.Blazor

MentorAgentBlazorOptions class

Configuration for AddMentorAgentBlazor(). Provides UI settings for the chat widget and the SignalR hub URL.

On this page

Namespace: Novior.MentorAgent.Blazor.Models. Package: Novior.MentorAgent.Blazor.

public sealed class MentorAgentBlazorOptions

Terminal
dotnet add package Novior.MentorAgent.Blazor

public MentorAgentBlazorOptions()

public Func<Task<string?>>? AccessTokenProvider { get; set; }

Supplies the bearer token for the hub connection, called on every connect and reconnect. Without this the hub sees an anonymous caller, whatever your application has signed the user in as — which means every RequiredRoles action is blocked and the user is keyed as anonymous: with the server's AnonymousIdentity = PerSession, the default, memory and RateLimitPerUser last only as long as the connection; with Shared every user shares the single memory key "anonymous" and one global limit. This is the WASM equivalent of the JavaScript client's accessTokenFactory, and the server reads the resulting principal off HubCallerContext.User. Return null while nobody is signed in; the connection then behaves exactly as it did before a provider was set.

Example
builder.Services.AddSingleton<TokenStore>();
builder.Services.AddMentorAgentBlazor(options =>
{
    options.HubUrl = "https://api.example.com/mentor-hub";
    options.AccessTokenProvider = () => Task.FromResult(tokenStore.Token);
});

public string? AiDisclosureMessage { get; set; }

The notice's text, shown as written. If null, uses the localized default in MentorAgentBlazorOptions.Language.

public List<string> AllowedImageTypes { get; set; }

Client-side MIME allow-list for attachments.

public string? AvatarUrl { get; set; }

Custom avatar URL.

public string BotName { get; set; }

Bot name shown in the widget header.

public Action<HttpConnectionOptions>? ConfigureConnection { get; set; }

Escape hatch applied to the hub's HttpConnectionOptions after MentorAgentBlazorOptions.AccessTokenProvider — custom headers, a transport restriction, cookies, UseDefaultCredentials. Use it for anything the options above do not name.

Example
options.ConfigureConnection = o => o.Headers["X-Tenant"] = tenantId;

public bool EnableImageInput { get; set; }

Show the image-attachment button and enable paste / drag-and-drop / URL input (roadmap #13). Must also be enabled server-side (MentorOptions.EnableImageInput), which is where attachments are actually validated.

public bool EnableOnboardingTour { get; set; }

Show the guided tour on first run (roadmap #18). Default: false.

public bool EnableSuggestions { get; set; }

Show suggestion chips in the welcome panel.

public bool EnableVoiceInput { get; set; }

Show microphone button for voice input.

public bool EnableVoiceOutput { get; set; }

Enable text-to-speech for AI responses.

public bool HasMcpServers { get; set; }

Whether the server has MCP servers configured (enables the MCP badge).

public bool HasRemoteAgents { get; set; }

Whether the server has remote A2A agents configured (enables the A2A badge).

public MentorHostedTools HostedTools { get; set; }

Hosted tools active on the server (roadmap #15), used to fill the badge. Mirror whatever MentorOptions.HostedTools is set to on the Novior.MentorAgent.Server project.

public string HubUrl { get; set; }

URL of the Novior.MentorAgent.Server SignalR hub. Default: "/mentor-hub". A relative URL is resolved against the page's base address, as a browser does ("/mentor-hub" against the origin, "mentor-hub" under the app's base path): use it when the server also serves the client. For a server on another origin, set its absolute URL.

public string? InputPlaceholder { get; set; }

Input box placeholder text. If null, uses the localized default in MentorAgentBlazorOptions.Language.

public MentorLanguage Language { get; set; }

Language for widget UI strings.

public int MaxImageBytes { get; set; }

Client-side size cap per image, in bytes. Default: 4 MB.

public int MaxImagesPerMessage { get; set; }

Client-side cap on images per message. Default: 4.

public List<string> McpServerNames { get; set; }

Names of MCP client servers configured on the server. Used to pre-populate the MCP status badge.

public ChatPosition Position { get; set; }

Widget position on screen.

public string? PrimaryColor { get; set; }

Custom accent color (hex, e.g. "#7c3aed").

public List<AgentDisplayInfo> RemoteAgentDisplays { get; set; }

Remote A2A agents to display in the A2A badge and detail bar.

public bool ShowA2AStatus { get; set; }

Show A2A remote agent status badge in the widget header.

public bool ShowAiDisclosure { get; set; }

Shows, under the header, the notice that tells people they are talking to an AI assistant, for the whole conversation. Default: true. The marker on each reply (data-ai-generated) stays either way.

public bool ShowHostedToolsStatus { get; set; }

Show the provider-hosted tools badge in the widget header (roadmap #15). Purely informational — the tools themselves are configured and executed server-side.

public bool ShowMcpStatus { get; set; }

Show MCP server connection status badge in the widget header.

public bool ShowRagSources { get; set; }

Show RAG source citations below AI responses.

public MentorTheme Theme { get; set; }

Visual theme.

public string TourUrl { get; set; }

Where to fetch the tour steps from (roadmap #18). Default: /mentor/tour.

A relative value is resolved against MentorAgentBlazorOptions.HubUrl's origin when that is absolute, because the tour is served by the same server as the hub — resolving it against the client app's own address instead would request it from a host that does not have it. Set an absolute URL here to override that entirely.

public bool VoiceBargeIn { get; set; }

Stop playback when the user presses the microphone or sends a message (roadmap #17). Default: true.

public bool VoiceHandsFree { get; set; }

Hands-free loop — send on silence, reopen the microphone after the answer (roadmap #17). Default: false.

public double VoiceRate { get; set; }

Speech rate for SpeechSynthesisUtterance (0.5–2.0). Default: 1.0.

public bool VoiceStreaming { get; set; }

Speak each sentence as it streams instead of reading the answer back (roadmap #17). Default: true.

public string? WelcomeMessage { get; set; }

Welcome message shown when the chat is empty.