Get the FREE Ultimate OpenClaw Setup Guide →

orchardcore-ai-chat-interactions

Scanned
npx machina-cli add skill CrestApps/CrestApps.AgentSkills/orchardcore-ai-chat-interactions --openclaw
Files (1)
SKILL.md
8.3 KB

Orchard Core AI Chat Interactions - Prompt Templates

Configure AI Chat Interactions

You are an Orchard Core expert. Generate code, configuration, and recipes for adding ad-hoc AI chat interactions with document upload, RAG, and intent-based prompt routing to an Orchard Core application using CrestApps modules.

Guidelines

  • The AI Chat Interactions module (CrestApps.OrchardCore.AI.Chat.Interactions) provides ad-hoc chat without predefined AI profiles.
  • Users can configure temperature, TopP, max tokens, frequency/presence penalties, and past messages count per session.
  • All chat messages are persisted and sessions can be resumed later.
  • Prompt routing uses intent detection to classify user prompts and route them to specialized processing strategies.
  • Intent detection can use a dedicated lightweight AI model or fall back to keyword-based detection.
  • The Documents extension adds document upload with RAG (Retrieval Augmented Generation) support.
  • Document indexing requires Elasticsearch or Azure AI Search as the embedding/search provider.
  • Install CrestApps packages in the web/startup project.
  • Always secure API keys using user secrets or environment variables.

Enabling AI Chat Interactions

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.AI",
        "CrestApps.OrchardCore.AI.Chat.Interactions",
        "CrestApps.OrchardCore.OpenAI"
      ],
      "disable": []
    }
  ]
}

Getting Started

  1. Enable the AI Chat Interactions feature in the Orchard Core admin under Configuration → Features.
  2. Navigate to Artificial Intelligence → Chat Interactions.
  3. Click + New Chat and select an AI provider connection.
  4. Configure chat settings (model, temperature, tools) and start chatting.

Built-in Intents

The AI Chat Interactions module ships with default intents for image and chart generation:

IntentDescriptionExample Prompts
GenerateImageGenerate an image from a text description"Generate an image of a sunset", "Create a picture of a cat"
GenerateImageWithHistoryGenerate an image using conversation context"Based on the above, draw a diagram"
GenerateChartGenerate a chart or graph specification"Create a bar chart of sales data", "Draw a pie chart"

Configuring Image Generation

To enable image generation, set the DefaultImagesDeploymentName in your provider connection.

Via Admin UI: Navigate to Artificial Intelligence → Provider Connections, edit your connection, and set the Images deployment name (e.g., dall-e-3).

Via appsettings.json:

{
  "OrchardCore": {
    "CrestApps_AI": {
      "Providers": {
        "OpenAI": {
          "Connections": {
            "default": {
              "DefaultDeploymentName": "gpt-4o",
              "DefaultImagesDeploymentName": "dall-e-3"
            }
          }
        }
      }
    }
  }
}

Configuring Intent Detection Model

Use a lightweight model for intent classification to optimize costs:

{
  "OrchardCore": {
    "CrestApps_AI": {
      "Providers": {
        "OpenAI": {
          "Connections": {
            "default": {
              "DefaultDeploymentName": "gpt-4o",
              "DefaultIntentDeploymentName": "gpt-4o-mini",
              "DefaultImagesDeploymentName": "dall-e-3"
            }
          }
        }
      }
    }
  }
}

If DefaultIntentDeploymentName is not configured, the system falls back to the DefaultDeploymentName (chat model) or keyword-based intent detection.

Enabling Document Upload and RAG

The Documents extension (CrestApps.OrchardCore.AI.Chat.Interactions.Documents) adds document upload and document-aware prompt processing. It requires a search/indexing provider.

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.AI",
        "CrestApps.OrchardCore.AI.Chat.Interactions",
        "CrestApps.OrchardCore.AI.Chat.Interactions.Documents.AzureAI",
        "OrchardCore.Search.AzureAI",
        "CrestApps.OrchardCore.OpenAI"
      ],
      "disable": []
    }
  ]
}

Or for Elasticsearch:

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.AI",
        "CrestApps.OrchardCore.AI.Chat.Interactions",
        "CrestApps.OrchardCore.AI.Chat.Interactions.Documents.Elasticsearch",
        "OrchardCore.Search.Elasticsearch",
        "CrestApps.OrchardCore.OpenAI"
      ],
      "disable": []
    }
  ]
}

Setting Up Document Indexing

  1. Enable a search provider feature (Elasticsearch or Azure AI Search).
  2. Navigate to Search → Indexing and create a new index (e.g., "ChatDocuments").
  3. Navigate to Settings → Chat Interaction and select the new index as the default document index.
  4. Enable the AI Chat Interactions - Documents feature.

Configuring Embedding Model for Documents

Documents require an embedding model for RAG. Configure DefaultEmbeddingDeploymentName in your provider connection:

{
  "OrchardCore": {
    "CrestApps_AI": {
      "Providers": {
        "OpenAI": {
          "Connections": {
            "default": {
              "DefaultDeploymentName": "gpt-4o",
              "DefaultEmbeddingDeploymentName": "text-embedding-3-small",
              "DefaultIntentDeploymentName": "gpt-4o-mini",
              "DefaultImagesDeploymentName": "dall-e-3"
            }
          }
        }
      }
    }
  }
}

Supported Document Formats

FormatExtensionRequired Feature
PDF.pdfCrestApps.OrchardCore.AI.Chat.Interactions.Pdf
Word.docxCrestApps.OrchardCore.AI.Chat.Interactions.OpenXml
Excel.xlsxCrestApps.OrchardCore.AI.Chat.Interactions.OpenXml
PowerPoint.pptxCrestApps.OrchardCore.AI.Chat.Interactions.OpenXml
Text.txtBuilt-in
CSV.csvBuilt-in
Markdown.mdBuilt-in
JSON.jsonBuilt-in
XML.xmlBuilt-in
HTML.html, .htmBuilt-in
YAML.yml, .yamlBuilt-in

Legacy Office formats (.doc, .xls, .ppt) are not supported. Convert them to newer formats.

Document Intent Types

When documents are uploaded, the intent detector routes prompts to specialized strategies:

IntentDescriptionExample Prompts
DocumentQnAQuestion answering using RAG"What does this document say about X?"
SummarizeDocumentDocument summarization"Summarize this document"
AnalyzeTabularDataCSV/Excel data analysis"Calculate the total sales"
ExtractStructuredDataStructured data extraction"Extract all email addresses"
CompareDocumentsMulti-document comparison"Compare these two documents"
TransformFormatContent reformatting"Convert to bullet points"
GeneralChatWithReferenceGeneral chat using document contextDefault fallback

Adding a Custom Processing Strategy

Register a custom intent and strategy to extend prompt routing:

public sealed class Startup : StartupBase
{
    public override void ConfigureServices(IServiceCollection services)
    {
        services.AddPromptProcessingIntent(
            "TranslateDocument",
            "The user wants to translate the document content to another language.");

        services.AddPromptProcessingStrategy<TranslateDocumentStrategy>();
    }
}

Enabling PDF and Office Document Support

{
  "steps": [
    {
      "name": "Feature",
      "enable": [
        "CrestApps.OrchardCore.AI.Chat.Interactions.Pdf",
        "CrestApps.OrchardCore.AI.Chat.Interactions.OpenXml"
      ],
      "disable": []
    }
  ]
}

Document Upload API Endpoints

EndpointMethodDescription
/ai/chat-interactions/upload-documentPOSTUpload one or more documents
/ai/chat-interactions/remove-documentPOSTRemove a document

Source

git clone https://github.com/CrestApps/CrestApps.AgentSkills/blob/main/src/CrestApps.AgentSkills/orchardcore/orchardcore-ai-chat-interactions/SKILL.mdView on GitHub

Overview

Configure ad-hoc AI chat interactions in Orchard Core using CrestApps. The skill enables prompt routing by intent, document upload with Retrieval-Augmented Generation (RAG), and generation of images and charts, plus custom processing strategies.

How This Skill Works

The CrestApps.OrchardCore.AI.Chat.Interactions module powers ad-hoc chats without predefined AI profiles. Users adjust model parameters (temperature, TopP, max tokens, penalties, past messages) and chats are persisted for later resume. Intent detection routes prompts to specialized processing strategies (lightweight AI model or keyword-based fallback), while the Documents extension enables RAG with document indexing via Elasticsearch or Azure AI Search.

When to Use It

  • When you need ad-hoc AI chats in an Orchard Core site without predefined AI profiles
  • When prompts should be routed to specialized processing strategies based on detected intent
  • When users upload documents and questions should be answered via RAG using Elasticsearch or Azure AI Search
  • When you want built-in image or chart generation from prompts
  • When you must secure API keys and persist chat sessions across visits

Quick Start

  1. Step 1: Enable the AI Chat Interactions feature under Configuration → Features and install CrestApps.OrchardCore.AI.Chat.Interactions and CrestApps.OrchardCore.OpenAI
  2. Step 2: Configure provider connections and set DefaultImagesDeploymentName and DefaultIntentDeploymentName in appsettings.json or via the Admin UI
  3. Step 3: Create a new chat under Artificial Intelligence → Chat Interactions, choose a provider, adjust chat settings (model, temperature, tools), and start chatting

Best Practices

  • Use a lightweight intent model for cost-efficient routing; fallback to keyword-based detection if the model is unavailable
  • Index documents with Elasticsearch or Azure AI Search to enable robust RAG retrieval
  • Persist chat sessions and enable users to resume conversations later
  • Configure image/chart generation via DefaultImagesDeploymentName and test with real prompts
  • Secure API keys with user secrets or environment variables and rotate credentials regularly

Example Use Cases

  • An Orchard Core site offers live customer support via ad-hoc AI chat with RAG-powered document answers
  • A business dashboard generates charts from natural-language prompts (e.g., sales by region) in chat
  • Users upload product manuals and PDFs to answer questions using RAG-backed retrieval
  • Prompts are routed to a summary or keyword-extraction processor based on detected intent
  • Images are generated on demand through a configured deployment (e.g., dall-e-3) within chat

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers