基于WebView2实现的Win11桌面框架,利用插件自定义
chunhualin1
2026-08-17 9b5711d3124622b1f1b18500d442c76492da877a
src/Moli.Desktop.Tests/WebView/PluginBridgeDispatcherTests.cs
@@ -67,6 +67,8 @@
        var json = JsonSerializer.Serialize(response.Result, new JsonSerializerOptions(JsonSerializerDefaults.Web));
        Assert.Contains("gpt-test", json);
        Assert.DoesNotContain("endpoint", json, StringComparison.OrdinalIgnoreCase);
        Assert.DoesNotContain("baseUrl", json, StringComparison.OrdinalIgnoreCase);
        Assert.DoesNotContain("authRef", json, StringComparison.OrdinalIgnoreCase);
    }
    [Fact]
@@ -108,6 +110,7 @@
        Assert.True(response.Success);
        var json = JsonSerializer.Serialize(response.Result, new JsonSerializerOptions(JsonSerializerDefaults.Web));
        Assert.Contains("project-1", json);
        Assert.Contains("ready", json);
    }
    [Fact]
@@ -214,6 +217,8 @@
    {
        public Task CancelAsync(string requestId, CancellationToken cancellationToken = default) => Task.CompletedTask;
        public Task CancelPluginRequestsAsync(string pluginId, CancellationToken cancellationToken = default) => Task.CompletedTask;
        public Task<IReadOnlyList<LlmModelSummary>> GetModelsAsync(CancellationToken cancellationToken = default)
            => Task.FromResult<IReadOnlyList<LlmModelSummary>>(
            [
@@ -242,11 +247,15 @@
                    .ToList())
                : GetModelsAsync(cancellationToken);
        public Task<IReadOnlyList<AiChatProjectSummary>> GetProjectsAsync(LlmPluginRuntimeConfig runtimeConfig, CancellationToken cancellationToken = default)
            => Task.FromResult<IReadOnlyList<AiChatProjectSummary>>(
            [
                new AiChatProjectSummary { Id = "project-1", Name = "Project 1" }
            ]);
        public Task<AiChatProjectsResult> GetProjectsAsync(LlmPluginRuntimeConfig runtimeConfig, CancellationToken cancellationToken = default)
            => Task.FromResult(new AiChatProjectsResult
            {
                Status = AiChatProjectStatuses.Ready,
                Projects =
                [
                    new AiChatProjectSummary { Id = "project-1", Name = "Project 1" }
                ]
            });
        public Task<AiChatMemoryCapabilities> GetMemoryCapabilitiesAsync(LlmPluginRuntimeConfig runtimeConfig, CancellationToken cancellationToken = default)
            => Task.FromResult(new AiChatMemoryCapabilities { CanUseMemory = true, CanViewMemory = true, CanManageMemory = true });