基于WebView2实现的Win11桌面框架,利用插件自定义
Moli
2026-05-05 4df6165fa93c7caeea86385312415e312de4d11f
src/Moli.Desktop/Host/DesktopHostBuilder.cs
@@ -7,6 +7,7 @@
using Moli.Desktop.Interop;
using Moli.Desktop.Layout;
using Moli.Desktop.Api;
using Moli.Desktop.Llm;
using Moli.Desktop.Management;
using Moli.Desktop.Plugins;
using Moli.Desktop.Runtime;
@@ -24,8 +25,10 @@
        return Microsoft.Extensions.Hosting.Host.CreateDefaultBuilder(args)
            .ConfigureLogging(logging =>
            {
                var paths = new DesktopPaths();
                logging.ClearProviders();
                logging.AddDebug();
                logging.AddProvider(new DailyFileLoggerProvider(paths.LogDirectory));
            })
            .ConfigureServices(services =>
            {
@@ -37,6 +40,14 @@
                services.AddSingleton<IRuntimeSurfaceController, RuntimeSurfaceController>();
                services.AddSingleton<IDesktopRuntime, DesktopRuntimeCoordinator>();
                services.AddSingleton<IConfigurationService, JsonConfigurationService>();
                services.AddSingleton<ILlmModelRegistry, LlmModelRegistry>();
                services.AddSingleton<ICredentialStore, EnvironmentCredentialStore>();
                services.AddHttpClient<OpenAICompatibleAdapter>();
                services.AddHttpClient<AiChatClient>();
                services.AddSingleton<IAiChatClient>(sp => sp.GetRequiredService<AiChatClient>());
                services.AddSingleton<ILlmProviderAdapter>(sp => sp.GetRequiredService<OpenAICompatibleAdapter>());
                services.AddSingleton<ILlmProviderAdapterFactory, LlmProviderAdapterFactory>();
                services.AddSingleton<ILlmGatewayService, LlmGatewayService>();
                services.AddSingleton<IPluginManifestValidator, PluginManifestValidator>();
                services.AddSingleton<PluginStateMachine>();
                services.AddSingleton<IPluginManager, PluginManager>();