You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
kev/Drawer/AI/ServiceCollectionExtensions.cs

30 lines
955 B
C#

using AI.AgentIntegration;
using AI.Interface;
using AI.Service;
using Microsoft.Extensions.DependencyInjection;
using AI.ViewModels;
namespace AI
{
public static class ServiceCollectionExtensions
{
public static void AddCommonServices(this IServiceCollection collection)
{
// 注册会话管理器
collection.AddSingleton<ChatSessionManager>();
// 注册聊天后端
collection.AddSingleton<IChatBackend, KernelService>();
// 注册主窗口 ViewModel
collection.AddSingleton<MainWindowViewModel>();
// 注册表单注册表与表单通知器
collection.AddSingleton<IAppController>(_ =>
AppControllerHolder.Instance ?? new NoOpAppController());
collection.AddSingleton<IFormRegistry, FormRegistry>();
collection.AddSingleton<IFormRequestNotifier, FormRequestNotifier>();
}
}
}