Add Luna.Configuration with TOML-based agent and provider config
Implement configuration system with embedded TOML resources for agent and provider definitions, custom IConfigurationSource/Provider for agent and provider options, and DI extension methods. Includes config models for agents, providers, sessions, and Telegram integration.
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
using Luna.Configuration.Services.Agents;
|
||||
using Luna.Configuration.Services.Providers;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Luna.Configuration.Extensions;
|
||||
|
||||
public static class ConfigurationBuilderExtensions
|
||||
{
|
||||
private static string[] AgentConfigSearchPaths =
|
||||
[
|
||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".luna", "agents")
|
||||
];
|
||||
|
||||
private static string[] ProviderConfigSearchPaths =
|
||||
[
|
||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".luna", "providers")
|
||||
];
|
||||
|
||||
extension(IConfigurationBuilder builder)
|
||||
{
|
||||
public IConfigurationBuilder AddLunaConfiguration()
|
||||
{
|
||||
builder.Add(new AgentOptionsConfigurationSource());
|
||||
|
||||
foreach (var searchPath in AgentConfigSearchPaths)
|
||||
{
|
||||
builder.Add(new AgentOptionsConfigurationSource(searchPath));
|
||||
}
|
||||
|
||||
builder.Add(new ProviderOptionsConfigurationSource());
|
||||
|
||||
foreach (var searchPath in ProviderConfigSearchPaths)
|
||||
{
|
||||
builder.Add(new ProviderOptionsConfigurationSource(searchPath));
|
||||
}
|
||||
|
||||
return builder;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user