Skip to content

Commit af21ebc

Browse files
authored
Allow the deployment to be configured from any provider (#384)
1 parent 1d642fa commit af21ebc

File tree

16 files changed

+820
-34
lines changed

16 files changed

+820
-34
lines changed

$PROFILE.txt

Whitespace-only changes.

.envrc

Lines changed: 0 additions & 1 deletion
This file was deleted.

copi.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
REM Set instructions folder
3+
set COPILOT_CUSTOM_INSTRUCTIONS_DIRS=%~dp0copilot-cli
4+
5+
REM Run Copilot CLI with any arguments passed
6+
copilot --allow-all %*

copilot-cli/commiting.instructions.md renamed to copilot-cli/.github/instructions/commiting.instructions.md

File renamed without changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
using System.Text.Json.Nodes;
2+
using CrestApps.OrchardCore.AI.Models;
3+
4+
namespace CrestApps.OrchardCore.AI.Core.Models;
5+
6+
/// <summary>
7+
/// Represents a deployment entry read from the application configuration (e.g., appsettings.json).
8+
/// Used to define AI deployments for both connection-based and contained-connection providers.
9+
/// </summary>
10+
public sealed class AIDeploymentConfigurationEntry
11+
{
12+
/// <summary>
13+
/// Gets or sets the deployment provider name for standalone configuration entries.
14+
/// </summary>
15+
public string ProviderName { get; set; }
16+
17+
/// <summary>
18+
/// Gets or sets the deployment model name (e.g., "gpt-4o", "my-speech-to-text").
19+
/// </summary>
20+
public string Name { get; set; }
21+
22+
/// <summary>
23+
/// Gets or sets the deployment type (Chat, Utility, Embedding, Image, SpeechToText, TextToSpeech).
24+
/// </summary>
25+
public AIDeploymentType Type { get; set; }
26+
27+
/// <summary>
28+
/// Gets or sets whether this deployment is the default for its type within its connection or provider.
29+
/// </summary>
30+
public bool IsDefault { get; set; }
31+
32+
/// <summary>
33+
/// Gets or sets provider-specific properties for contained-connection deployments.
34+
/// These are usually flattened from top-level fields such as Endpoint, AuthenticationType, ApiKey, and IdentityId.
35+
/// </summary>
36+
public JsonObject Properties { get; set; }
37+
}

src/Core/CrestApps.OrchardCore.AI.Core/ServiceCollectionExtensions.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,13 @@ public static IServiceCollection AddAIDeploymentServices(this IServiceCollection
5252
{
5353
services
5454
.AddScoped<DefaultAIDeploymentStore>()
55-
.AddScoped<ICatalog<AIDeployment>>(sp => sp.GetRequiredService<DefaultAIDeploymentStore>())
56-
.AddScoped<INamedCatalog<AIDeployment>>(sp => sp.GetRequiredService<DefaultAIDeploymentStore>())
57-
.AddScoped<INamedSourceCatalog<AIDeployment>>(sp => sp.GetRequiredService<DefaultAIDeploymentStore>())
58-
.AddScoped<IAIDeploymentManager, DefaultAIDeploymentManager>()
55+
.AddScoped<ConfigurationAIDeploymentStore>()
56+
.AddScoped<ICatalog<AIDeployment>>(sp => sp.GetRequiredService<ConfigurationAIDeploymentStore>())
57+
.AddScoped<INamedCatalog<AIDeployment>>(sp => sp.GetRequiredService<ConfigurationAIDeploymentStore>())
58+
.AddScoped<INamedSourceCatalog<AIDeployment>>(sp => sp.GetRequiredService<ConfigurationAIDeploymentStore>())
59+
.AddScoped<DefaultAIDeploymentManager>()
60+
.AddScoped<IAIDeploymentManager>(sp => sp.GetRequiredService<DefaultAIDeploymentManager>())
61+
.AddScoped<INamedSourceCatalogManager<AIDeployment>>(sp => sp.GetRequiredService<DefaultAIDeploymentManager>())
5962
.AddScoped<ICatalogEntryHandler<AIDeployment>, AIDeploymentHandler>();
6063

6164
return services;

0 commit comments

Comments
 (0)