Rename Model to ServiceProfile across the codebase.
Changed class names, properties, and variables from Model to ServiceProfile for improved semantics and readability. Updated corresponding filenames and configuration settings to maintain consistency.
This commit is contained in:
parent
704009fda7
commit
84893e6c80
|
|
@ -39,7 +39,7 @@
|
|||
"Value": ""
|
||||
}
|
||||
],
|
||||
"Models": [
|
||||
"ServiceProfiles": [
|
||||
{
|
||||
"Name": "Gpt4o",
|
||||
"Services": [
|
||||
|
|
@ -376,7 +376,7 @@
|
|||
"Agents": [
|
||||
{
|
||||
"Name": "ContentManager",
|
||||
"Models": [
|
||||
"ServiceProfiles": [
|
||||
"Gpt4o"
|
||||
],
|
||||
"Skills": [
|
||||
|
|
@ -391,7 +391,7 @@
|
|||
},
|
||||
{
|
||||
"Name": "Artist",
|
||||
"Models": [
|
||||
"ServiceProfiles": [
|
||||
"Gpt4o"
|
||||
],
|
||||
"Skills": [
|
||||
|
|
@ -400,7 +400,7 @@
|
|||
},
|
||||
{
|
||||
"Name": "Translator",
|
||||
"Models": [
|
||||
"ServiceProfiles": [
|
||||
"Gpt4o"
|
||||
],
|
||||
"Skills": [
|
||||
|
|
@ -409,7 +409,7 @@
|
|||
},
|
||||
{
|
||||
"Name": "Author",
|
||||
"Models": [
|
||||
"ServiceProfiles": [
|
||||
"Gpt4o"
|
||||
],
|
||||
"Skills": [
|
||||
|
|
|
|||
|
|
@ -17,4 +17,8 @@
|
|||
<ProjectReference Include="..\Elsa.Common\Elsa.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Contracts\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ using Elsa.Common.Entities;
|
|||
|
||||
namespace Elsa.Agents;
|
||||
|
||||
public class ModelDefinition : Entity
|
||||
public class ServiceProfileDefinition : Entity
|
||||
{
|
||||
public string Name { get; set; } = default!;
|
||||
public ICollection<ServiceConfig> Services { get; set; } = [];
|
||||
|
|
@ -9,7 +9,7 @@ public class ConfigureKernel(KernelConfig kernelConfig, IOptions<AgentsOptions>
|
|||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
foreach (var apiKey in options.Value.ApiKeys) kernelConfig.ApiKeys[apiKey.Name] = apiKey;
|
||||
foreach (var model in options.Value.Models) kernelConfig.Models[model.Name] = model;
|
||||
foreach (var serviceProfile in options.Value.ServiceProfiles) kernelConfig.ServiceProfiles[serviceProfile.Name] = serviceProfile;
|
||||
foreach (var skill in options.Value.Skills) kernelConfig.Skills[skill.Name] = skill;
|
||||
foreach (var plugin in options.Value.Plugins) kernelConfig.Plugins[plugin.Name] = plugin;
|
||||
foreach (var agent in options.Value.Agents) kernelConfig.Agents[agent.Name] = agent;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ namespace Elsa.Agents;
|
|||
public class AgentConfig
|
||||
{
|
||||
public string Name { get; set; } = default!;
|
||||
public ICollection<string> Models { get; set; } = new List<string>();
|
||||
public ICollection<string> ServiceProfiles { get; set; } = new List<string>();
|
||||
public ICollection<string> Skills { get; set; } = new List<string>();
|
||||
}
|
||||
|
|
@ -3,7 +3,7 @@ namespace Elsa.Agents;
|
|||
public class KernelConfig
|
||||
{
|
||||
public IDictionary<string, ApiKeyConfig> ApiKeys { get; set; } = new Dictionary<string, ApiKeyConfig>();
|
||||
public IDictionary<string, ModelConfig> Models { get; } = new Dictionary<string, ModelConfig>();
|
||||
public IDictionary<string, ServiceProfileConfig> ServiceProfiles { get; } = new Dictionary<string, ServiceProfileConfig>();
|
||||
public IDictionary<string, PluginConfig> Plugins { get; } = new Dictionary<string, PluginConfig>();
|
||||
public IDictionary<string, SkillConfig> Skills { get; } = new Dictionary<string, SkillConfig>();
|
||||
public IDictionary<string, AgentConfig> Agents { get; } = new Dictionary<string, AgentConfig>();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
namespace Elsa.Agents;
|
||||
|
||||
public class ModelConfig
|
||||
public class ServiceProfileConfig
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public ICollection<ServiceConfig> Services { get; set; }
|
||||
|
|
@ -3,7 +3,7 @@ namespace Elsa.Agents.Options;
|
|||
public class AgentsOptions
|
||||
{
|
||||
public ICollection<ApiKeyConfig> ApiKeys { get; set; }
|
||||
public ICollection<ModelConfig> Models { get; set; }
|
||||
public ICollection<ServiceProfileConfig> ServiceProfiles { get; set; }
|
||||
public ICollection<PluginConfig> Plugins { get; set; }
|
||||
public ICollection<SkillConfig> Skills { get; set; }
|
||||
public ICollection<AgentConfig> Agents { get; set; }
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ public class KernelFactory(KernelConfig kernelConfig, IServiceProvider servicePr
|
|||
|
||||
private void AddModels(IKernelBuilder builder, AgentConfig agentConfig)
|
||||
{
|
||||
foreach (string modelName in agentConfig.Models)
|
||||
foreach (string modelName in agentConfig.ServiceProfiles)
|
||||
{
|
||||
if (!kernelConfig.Models.TryGetValue(modelName, out var model))
|
||||
if (!kernelConfig.ServiceProfiles.TryGetValue(modelName, out var model))
|
||||
{
|
||||
logger.LogWarning($"Model {modelName} not found");
|
||||
continue;
|
||||
|
|
@ -54,9 +54,9 @@ public class KernelFactory(KernelConfig kernelConfig, IServiceProvider servicePr
|
|||
}
|
||||
}
|
||||
|
||||
private void AddServices(IKernelBuilder builder, ModelConfig model)
|
||||
private void AddServices(IKernelBuilder builder, ServiceProfileConfig serviceProfile)
|
||||
{
|
||||
foreach (var service in model.Services)
|
||||
foreach (var service in serviceProfile.Services)
|
||||
{
|
||||
switch (service.Type)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue