Configures and extends AI Chat in Orchard Core using the CrestApps AI Chat module. Covers chat profiles, admin widgets, session history, AG-UI tool cards, rate limits, and SignalR hub methods.
Ships in crestapps-orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
You are an Orchard Core expert. Generate code, configuration, and recipes for adding profile-driven AI chat to an Orchard Core application with the CrestApps AI Chat module.
CrestApps.OrchardCore.AI.Chat and at least one provider package (OpenAI, Azure OpenAI, Azure AI Inference or Ollama) in the web/startup project.CrestApps.OrchardCore.AI.Chat depends on OrchardCore.SignalR (the Orchard Core module, not the deprecated CrestApps one), OrchardCore.Liquid, CrestApps.OrchardCore.Resources, CrestApps.OrchardCore.AI and the dependency-only CrestApps.OrchardCore.AI.Chat.Core (AI Chat Services).Properties.AIDeploymentMetadata.Features. The deployment purpose (Purpose, Type) is gone in 3.0. Which deployment serves chat, utility, speech and the other slots is chosen on the Default deployments card of Settings > Artificial Intelligence or on the profile. See orchardcore-ai-model-capabilities.AIChatProfileSettings.IsOnAdminMenu) appears under Artificial Intelligence. The menu entry needs QueryAnyAIProfile or the per-profile QueryAIProfile_{profileName} permission.orchardcore-ai-profile-templates.orchardcore-ai-realtime-voice.profile.TryGetSettings<ChatModeProfileSettings>() and write them with profile.AlterSettings<ChatModeProfileSettings>(...). They live in AIProfile.Settings, not in Properties.{ "steps": [...] } format and C# classes are sealed, except view models.| Feature | ID | Notes |
|---|---|---|
| AI Chat | CrestApps.OrchardCore.AI.Chat | Admin chat UI, frontend widget, chat modes, prompt security and visitor identity settings |
| AI Chat Admin Widget | CrestApps.OrchardCore.AI.Chat.AdminWidget | Floating chat on every admin page. Depends on AI Chat and CrestApps.OrchardCore.AI.Agent |
| AI Chat Session Analytics | CrestApps.OrchardCore.AI.Chat.Analytics | See orchardcore-ai-chat-analytics |
| AI Chat Services | CrestApps.OrchardCore.AI.Chat.Core | Dependency only; hub, session manager and handlers |
| AI Chat WebAPI | CrestApps.OrchardCore.AI.Chat.Api | REST chat API and the AG-UI endpoint POST /api/ai/v1/agui, shipped by the AI module |
Provider features: CrestApps.OrchardCore.OpenAI, CrestApps.OrchardCore.OpenAI.Azure, CrestApps.OrchardCore.AzureAIInference, CrestApps.OrchardCore.Ollama. See orchardcore-ai-providers.
{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.AI.Chat",
"CrestApps.OrchardCore.OpenAI"
],
"disable": []
}
]
}
{
"steps": [
{
"name": "AIProviderConnections",
"Connections": [
{
"Source": "OpenAI",
"Name": "openai",
"DisplayText": "OpenAI",
"Properties": {
"OpenAIConnectionMetadata": {
"Endpoint": "https://api.openai.com/v1",
"ApiKey": "{{YourApiKey}}"
}
}
}
]
},
{
"name": "AIDeployment",
"Deployments": [
{
"Name": "gpt-4o",
"ClientName": "OpenAI",
"ConnectionName": "openai",
"Properties": {
"AIDeploymentMetadata": {
"Features": [ "textGeneration", "toolCalling", "streaming" ]
}
}
},
{
"Name": "gpt-4o-mini",
"ClientName": "OpenAI",
"ConnectionName": "openai",
"Properties": {
"AIDeploymentMetadata": {
"Features": [ "textGeneration", "toolCalling", "streaming" ]
}
}
}
]
},
{
"name": "AIProfile",
"Profiles": [
{
"Name": "customer-support-chat",
"DisplayText": "Customer Support Chat",
"WelcomeMessage": "Hello! How can I help you today?",
"Type": "Chat",
"TitleType": "InitialPrompt",
"ChatDeploymentName": "gpt-4o",
"UtilityDeploymentName": "gpt-4o-mini",
"Properties": {
"AIProfileMetadata": {
"SystemMessage": "You are a helpful customer support assistant. Be friendly and concise.",
"Temperature": 0.3,
"MaxTokens": 2048,
"PastMessagesCount": 10
}
},
"Settings": {
"AIChatProfileSettings": {
"IsOnAdminMenu": true
},
"ChatModeProfileSettings": {
"ChatMode": "TextInput",
"EnableTextToSpeechPlayback": false
}
}
}
]
}
]
}
Source is not needed.ChatDeploymentName empty uses the connection default, then Default chat deployment in site settings."PersonaId" on the profile. See orchardcore-ai-personas.public sealed class SiteAssistantMigrations : DataMigration
{
private readonly IAIProfileManager _profileManager;
public SiteAssistantMigrations(IAIProfileManager profileManager)
{
_profileManager = profileManager;
}
public async Task<int> CreateAsync()
{
var profile = await _profileManager.NewAsync();
profile.Name = "site-assistant";
profile.DisplayText = "Site Assistant";
profile.Type = AIProfileType.Chat;
profile.WithSettings(new AIProfileSettings
{
LockSystemMessage = true,
IsRemovable = false,
IsListable = true,
});
profile.WithSettings(new AIChatProfileSettings
{
IsOnAdminMenu = true,
});
profile.Put(new AIProfileMetadata
{
SystemMessage = "You are a site assistant. Help users navigate the site and answer questions.",
Temperature = 0.3f,
MaxTokens = 4096,
PastMessagesCount = 10,
});
var result = await _profileManager.ValidateAsync(profile);
if (result.Succeeded)
{
await _profileManager.CreateAsync(profile);
}
return 1;
}
}
IAIProfileManager is a catalog manager: NewAsync, ValidateAsync, CreateAsync, UpdateAsync, FindByNameAsync, DeleteAsync. There is no SaveAsync.
For agent profiles, profile types and tools, see orchardcore-ai, orchardcore-ai-agent and orchardcore-ai-tools. The framework profile API is described in crestapps-core-ai-profiles.
orchardcore-ai-conversations).WebMcpProfileSettings): the chat discovers and runs the WebMCP tools of the page the user has open, through the hub's SetPageTools and ClearPageTools. See orchardcore-ai-webmcp.AIProfileMetadata.InitialPrompt. The session is created lazily: it is persisted only when the visitor sends the first message, and the opening message is inserted ahead of it.| Mode | Behavior | Requirement |
|---|---|---|
TextInput | Typed chat (default) | None |
AudioInput | Microphone dictation; transcript is placed in the input for review | A speech-to-text deployment in the speechToText slot |
Conversation | Voice toggle beside a working message box; both kinds of turn land in one thread | A realtime deployment that resolves, or both speech-to-text and text-to-speech deployments |
profile.AlterSettings<ChatModeProfileSettings>(settings =>
{
settings.ChatMode = ChatMode.Conversation;
// Empty means the site's default realtime deployment, then the first realtime-capable one.
settings.ConversationDeploymentName = "gpt-realtime";
settings.VoiceName = "alloy";
settings.EnableTextToSpeechPlayback = false;
});
VoiceName is kept whatever the mode, because phone calls answered or placed with the profile use it. Without one, the persona's voice, then the site default voice, then the provider default is used.orchardcore-ai-realtime-voice.| Route | Purpose | Permission |
|---|---|---|
ai/chat/session/{profileId}/{sessionId?} | Admin chat session | QueryAnyAIProfile or QueryAIProfile_{name} |
ai/chat/history/{profileId} | Chat history (AIChatSessions admin list) | Same |
ai/chat/test/{profileId} | Invoke profile for Utility and Agent profiles; no session, history or metrics | QueryAnyAIProfile |
ai/chat/chat-session/delete/{sessionId} | Delete one session | DeleteChatSession |
ai/chat/history/{profileId}/delete-all | Delete all sessions of a profile | DeleteAllChatSessions |
The history page renders through Orchard Core's AdminList shape (AIChatSessions, rows are AIChatSessionEntry_SummaryAdmin, grid columns Name, Status, LastActivity, Actions). Add columns with an IAdminListColumnsProvider for AIChatSessions; see orchardcore-admin-lists.
Enable CrestApps.OrchardCore.AI.Chat.AdminWidget, then pick the profile, the history size (1 to 50, default 10), the primary color (default #41b670) and Tell the AI which page the user is on (SendPageContext, on by default) on the Admin widget card of Settings > Artificial Intelligence (permission ManageAIProfiles). It renders for signed-in users allowed to query that profile and keeps its position, size and session in browser local storage.
{
"steps": [
{
"name": "Settings",
"AIChatAdminWidgetSettings": {
"ProfileId": "<chat-profile-id>",
"MaxSessions": 10,
"PrimaryColor": "#41b670",
"SendPageContext": true
}
}
]
}
The chat page, the admin widget, the frontend widget and the profile test page run the chat as an AG-UI agent over the AI chat hub (RunAgent, from CrestApps.Core; see crestapps-core-ag-ui). Nothing needs to be enabled.
.WithTitle(...)), input and result, also after the chat reloads. The UI texts are localized by AIChatUIConfiguration..RequireApproval() waits for the user: the run ends with an interrupt, the card shows Allow and Deny, and the answer starts a new run. The tool's own permission checks still run. Chats that cannot ask (SMS, voice) run such tools as before. The Orchard Core AI Agent tools that delete, disable, import, set up tenants or send email/SMS ask first.ContentItemPageContextProvider (content item being edited or viewed, or the type being created; needs OrchardCore.Contents) and SitePageContextProvider (site name and tenant). SendPageContext = false turns all of it off.page_read_content), fills forms without submitting them and opens other site pages; a page_navigate run continues on the next page (up to five pages in a row). See orchardcore-ai-webmcp.services.AddCoreAITool<ArchiveOrdersTool>(ArchiveOrdersTool.TheName)
.WithTitle(S["Archive orders"])
.RequireApproval()
.Selectable();
A module adds context for the records it owns with IAIChatPageContextProvider (CrestApps.OrchardCore.AI.Chat.Core.Services). Providers run when the widget renders on each admin page, so read only what is already loaded or cached:
public sealed class OrderPageContextProvider : IAIChatPageContextProvider
{
public Task PopulateAsync(AIChatPageContext context)
{
if (context.GetRouteValue("area") == "MyCompany.Orders" && context.GetRouteValue("orderId") is { } orderId)
{
context.Add("Order being edited", $"Order {orderId}");
}
return Task.CompletedTask;
}
}
// In the startup of the feature that owns orders:
services.AddScoped<IAIChatPageContextProvider, OrderPageContextProvider>();
AG-UI endpoint. With AI Chat WebAPI (CrestApps.OrchardCore.AI.Chat.Api), any AG-UI client (such as a CopilotKit front end) runs chat profiles at POST /api/ai/v1/agui with a RunAgentInput, answered as Server-Sent Events. Put the profile id in forwardedProps.profileId and the session id in threadId (empty starts a session). Authenticate with an AI API key whose areas include ai.chat (X-Api-Key header or bearer) or an OpenID bearer token; others get 401. The hub then authorizes the profile and session. JSON only, no antiforgery token.
With OrchardCore.Widgets enabled, the module creates the AIChat widget type (Artificial Intelligence Chat) with AIProfilePart (ProfileId, TotalHistory). The widget renders only for visitors allowed to query the profile, so grant the Anonymous role QueryAIProfile_{profileName} for a public assistant. History is listed for the visitor's own identity: a signed-in user's sessions, or the sessions owned by an anonymous visitor's cookie.
{
"steps": [
{
"name": "Roles",
"Roles": [
{
"Name": "Anonymous",
"PermissionBehavior": "Add",
"Permissions": [ "QueryAIProfile_customer-support-chat" ]
}
]
}
]
}
Both are cards of Settings > Artificial Intelligence (Prompt security, with Rate limits, and Visitor identity) (permission ManageAIProfiles) and both are site settings that can be set with the Settings recipe step. Saving either still releases the tenant shell, because their readers in CrestApps.Core use IOptions<T>.
{
"steps": [
{
"name": "Settings",
"PromptSecurityOptions": {
"EnableInjectionDetection": true,
"MaxPromptLength": 8000,
"BlockingThreshold": "High",
"MaxMessagesPerWindow": 20,
"RateLimitWindow": "00:01:00",
"AnonymousMessageRateLimitTiers": [
{ "Limit": 5, "Window": "00:00:30" },
{ "Limit": 150, "Window": "01:00:00" }
],
"AnonymousSessionStartRateLimitTiers": [
{ "Limit": 10, "Window": "00:05:00" }
]
},
"AIVisitorIdentityOptions": {
"CookieName": "crestapps-ai-visitor",
"CookieLifetime": "180.00:00:00",
"AllowCrossSiteEmbedding": true,
"UsePartitionedCookie": true,
"RemoteAddressMode": "Hashed"
}
}
]
}
MaxAnonymousSessionsPerWindow has no effect while tiers are set; clear the tier list or lower a tier instead.20.ReceiveSessionStartRejected with a generic, localizable message.AllowCrossSiteEmbedding only when the chat runs in a frame on another site. It writes the cookie SameSite=None; Secure (HTTPS requests only) and UsePartitionedCookie adds Partitioned.RemoteAddressMode values are Disabled, Hashed (recommended), PlainText and Encrypted. Configure forwarded headers behind a reverse proxy.CrestApps.OrchardCore.AI.Documents.ChatSessions and turn on Allow session document uploads and Allow session image uploads per profile (AIProfileSessionDocumentsMetadata). Image uploads also need a vision deployment. See orchardcore-ai-documents.[doc:N] markers render as superscript citations with a linked reference list in the admin chat, the admin widget and the frontend widget.chat-image-carousel.The hub is mapped with SignalRHubRoutes.GetHubPath<AIChatHub>(), and ConfigureCrestAppsChatHubOptions<AIChatHub>() sets its SignalR options.
| Method | Purpose |
|---|---|
StartSession | Start a session for a profile |
LoadSession | Load a session and join its group |
SendMessage | Stream a reply to a typed prompt |
SendAudioStream | Stream audio for dictation |
StartConversation / StopConversation | Speech-to-text plus text-to-speech conversation |
StartRealtimeConversation / StartRealtimeWebRtc | Realtime voice over WebSocket or WebRTC |
GetRealtimeIceServers, AddRealtimeIceCandidate, UpdateRealtimeSettings, UpdateRealtimeSpeechSpeed | Realtime session control |
SynthesizeSpeech | Read an answer aloud |
RateMessage | Thumbs up or down |
HandleNotificationAction | Run a notification action, see orchardcore-ai-chat-notifications |
RunAgent | Run one AG-UI turn (the chat UI and widgets use it; tool cards, approvals and page context ride on it) |
SetPageTools / ClearPageTools | Register or clear the WebMCP tools of the user's current page (WebMCP bridge) |
The chat UI comes from the @crestapps/ai-chat-ui package. Scripts AIChatApp, AIChatWidgetApp, realtime-audio and chat-image-carousel, and styles AIChatApp, AIChatWidget and chat-image-carousel, are registered by the modules. Assistant messages show the persona's name and avatar when a persona is linked.
"Purpose": "Chat" and similar on deployments with Properties.AIDeploymentMetadata.Features. Old recipes and stored records still import because the purpose is projected onto capabilities on read.ChatMode.Realtime and the separate realtime deployment field are gone. Put the speech-to-speech model in ChatModeProfileSettings.ConversationDeploymentName and set ChatMode to Conversation. Stored profiles are folded on read.OrchardCore.SignalR directly, and HubRouteManager is replaced by SignalRHubRoutes.GetHubPath<T>() and Html.SignalRHubUrl<T>().AdminList shape. A theme override of the whole row only applies to the List layout.Create?templateId=.ai-chat.css.map and chat-widget.css.map are no longer shipped.See ai-chat-examples.md for more recipes.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/crestapps-orchardcore:orchardcore-ai-chatfrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts.Other plugins' skills for the same job