Skip to content

Commit 959c5ba

Browse files
authored
Fix ai-settings (#413)
1 parent 6abddc3 commit 959c5ba

File tree

6 files changed

+25
-19
lines changed

6 files changed

+25
-19
lines changed

src/CrestApps.OrchardCore.Documentations/docs/ai/copilot.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ Use this mode when you want the orchestrator to authenticate to Copilot via GitH
6363
- GitHub Settings → Developer settings → OAuth Apps → **New OAuth App**
6464
- **Authorization callback URL**: `https://your-domain.com/copilot/OAuthCallback`
6565
- Copy the **Client ID** and **Client Secret**
66-
2. In Orchard Core: go to **Settings → Copilot** and enter the client ID/secret.
66+
2. In Orchard Core: go to **Settings → Artificial Intelligence → Copilot** and enter the client ID/secret.
67+
3. If AI Memory or AI Documents features are enabled but not configured yet, you can still save Copilot settings first and come back later to choose those index profiles.
6768

6869
#### Required OAuth scopes
6970

src/CrestApps.OrchardCore.Documentations/docs/ai/documents/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ The orchestrator supports various document-related operations:
7575

7676
1. **Set up an indexing provider**: Enable Elasticsearch or Azure AI Search in the Orchard Core admin.
7777
2. **Create an index**: Navigate to **Search > Indexing** and create a new index (e.g., "AI Documents").
78-
3. **Configure settings**: Navigate to **Settings > Artificial Intelligence** and select your new index. After this is configured in production, avoid changing the index profile to prevent losing access to documents in existing sessions.
78+
3. **Configure settings**: Navigate to **Settings > Artificial Intelligence** and select your new index. You can leave the document index empty until you are ready to enable document retrieval; after this is configured in production, avoid changing the index profile to prevent losing access to documents in existing sessions.
7979
4. **Enable the feature**: Enable `AI Chat Interaction Documents` in the admin dashboard.
8080
5. Start using the Documents tab in your chat interactions.
8181

@@ -184,7 +184,7 @@ For **AI Chat Widget** content items, the same checkbox appears on the widget ed
184184

185185
1. **Set up an indexing provider**: Enable Elasticsearch or Azure AI Search in the Orchard Core admin.
186186
2. **Create an index**: Navigate to **Search > Indexing** and create a new index (e.g., "AI Documents").
187-
3. **Configure settings**: Navigate to **Settings > Artificial Intelligence** and select your new index. After this is configured in production, avoid changing the index profile to prevent losing access to documents in existing sessions.
187+
3. **Configure settings**: Navigate to **Settings > Artificial Intelligence** and select your new index. You can leave the document index empty until you are ready to enable document retrieval; after this is configured in production, avoid changing the index profile to prevent losing access to documents in existing sessions.
188188
4. **Enable the feature**: Enable `AI Documents for Chat Sessions` in the admin dashboard.
189189
5. **Opt in per profile**: Edit the desired AI Profile and check **Allow Documents & Attachments**.
190190
6. Open a chat session — the attach button and drag-and-drop zone are now available.
@@ -233,6 +233,7 @@ This ensures the AI document indexes stay free of orphaned entries when their pa
233233

234234
If you see this warning, navigate to **Settings > Artificial Intelligence** and select an index profile.
235235
If no index profiles are available, go to **Search > Indexing**, add an **AI Documents** index, and enable one of the **AI Documents indexing** features if the **AI Documents** index type is not listed.
236+
Leaving the setting empty is supported while you are configuring other AI features, but document retrieval remains unavailable until a valid index profile is selected.
236237

237238
### "Embedding Search Service Not Available" Warning
238239

src/CrestApps.OrchardCore.Documentations/docs/ai/memory.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ Navigate to **Settings → Artificial Intelligence → Memory** and configure:
112112
- **Index profile** — the master memory index used for storing memories
113113
- **Default top N** — the default number of matching memories returned by searches
114114

115+
You can leave **Index profile** empty while you are still setting up unrelated AI features such as Copilot. Memory retrieval and indexing stay inactive until you select a valid memory index profile.
116+
115117
Preemptive memory retrieval itself is controlled separately under **Settings → Artificial Intelligence → General** through **Enable Preemptive Memory Retrieval**. This lets you keep user memory tools enabled while turning off the upfront memory injection step for the tenant.
116118

117119
:::warning

src/CrestApps.OrchardCore.Documentations/docs/changelog/v2.0.0.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ At a high level, `2.0.0` introduces a new generation of CrestApps.OrchardCore bu
3333

3434
For a broad product tour, see the [Artificial Intelligence Suite overview](../ai/index.md) and [Omnichannel Communications](../omnichannel/index.md).
3535

36+
### Recent fixes
37+
38+
- Fixed **Settings → Artificial Intelligence** so Copilot settings can be saved even when AI Memory or AI Documents index profiles have not been configured yet.
39+
- AI Memory and AI Documents still validate non-empty index profile selections, but leaving those settings empty now keeps the related features inactive instead of blocking unrelated settings changes.
40+
3641
---
3742

3843
## Major platform shifts

src/Modules/CrestApps.OrchardCore.AI.Documents/Drivers/InteractionDocumentSettingsDisplayDriver.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,20 @@ public override async Task<IDisplayResult> UpdateAsync(ISite site, InteractionDo
6262

6363
await context.Updater.TryUpdateModelAsync(model, Prefix);
6464

65-
if (string.IsNullOrEmpty(model.IndexProfileName))
66-
{
67-
context.Updater.ModelState.AddModelError(Prefix, nameof(model.IndexProfileName), S["The index profile field is required."]);
68-
}
69-
else
65+
settings.IndexProfileName = string.IsNullOrWhiteSpace(model.IndexProfileName)
66+
? null
67+
: model.IndexProfileName;
68+
69+
if (!string.IsNullOrWhiteSpace(settings.IndexProfileName))
7070
{
71-
var indexProfile = await _indexProfileStore.FindByNameAsync(model.IndexProfileName);
71+
var indexProfile = await _indexProfileStore.FindByNameAsync(settings.IndexProfileName);
7272

73-
if (indexProfile == null || indexProfile.Type != AIConstants.AIDocumentsIndexingTaskType)
73+
if (indexProfile is null || !string.Equals(indexProfile.Type, AIConstants.AIDocumentsIndexingTaskType, StringComparison.OrdinalIgnoreCase))
7474
{
7575
context.Updater.ModelState.AddModelError(Prefix, nameof(model.IndexProfileName), S["Invalid index profile."]);
7676
}
7777
}
7878

79-
settings.IndexProfileName = model.IndexProfileName;
80-
8179
return Edit(site, settings, context);
8280
}
8381
}

src/Modules/CrestApps.OrchardCore.AI.Memory/Drivers/AIMemorySettingsDisplayDriver.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,21 +60,20 @@ public override async Task<IDisplayResult> UpdateAsync(ISite site, AIMemorySetti
6060

6161
await context.Updater.TryUpdateModelAsync(model, Prefix);
6262

63-
if (string.IsNullOrEmpty(model.IndexProfileName))
64-
{
65-
context.Updater.ModelState.AddModelError(Prefix, nameof(model.IndexProfileName), S["The index profile field is required."]);
66-
}
67-
else
63+
settings.IndexProfileName = string.IsNullOrWhiteSpace(model.IndexProfileName)
64+
? null
65+
: model.IndexProfileName;
66+
67+
if (!string.IsNullOrWhiteSpace(settings.IndexProfileName))
6868
{
69-
var indexProfile = await _indexProfileStore.FindByNameAsync(model.IndexProfileName);
69+
var indexProfile = await _indexProfileStore.FindByNameAsync(settings.IndexProfileName);
7070

7171
if (indexProfile is null || !string.Equals(indexProfile.Type, MemoryConstants.IndexingTaskType, StringComparison.OrdinalIgnoreCase))
7272
{
7373
context.Updater.ModelState.AddModelError(Prefix, nameof(model.IndexProfileName), S["Invalid index profile."]);
7474
}
7575
}
7676

77-
settings.IndexProfileName = model.IndexProfileName;
7877
settings.TopN = Math.Clamp(model.TopN, 1, 20);
7978

8079
return Edit(site, settings, context);

0 commit comments

Comments
 (0)