基于WebView2实现的Win11桌面框架,利用插件自定义
chunhualin1
2026-08-14 b84db8983d63a9a981083ebce1a139860c6bdf25
src/Moli.Desktop/Llm/LlmModels.cs
@@ -14,12 +14,18 @@
    public required string Id { get; init; }
    public required string Label { get; init; }
    public required string Provider { get; init; }
    public required string Endpoint { get; init; }
    public string? BaseUrl { get; init; }
    [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
    public string? Endpoint { get; init; }
    public string? AuthRef { get; init; }
    public required string ApiModel { get; init; }
    public bool SupportsStreaming { get; init; } = true;
    public bool Enabled { get; init; }
    public LlmRequestDefaults RequestDefaults { get; init; } = new();
    public string? GetBaseUrl() => LlmOpenAiUrls.ResolveBaseUrl(BaseUrl, Endpoint);
    public string? GetChatCompletionsUrl() => LlmOpenAiUrls.ToChatCompletionsUrl(BaseUrl, Endpoint);
}
public sealed record LlmRequestDefaults
@@ -142,9 +148,24 @@
    public string Mode { get; init; } = LlmConnectionModes.ProviderDirect;
    public AiChatRuntimeConfig AiChat { get; init; } = new();
    public string? DefaultModel { get; init; }
    public List<LlmProviderConfig> Providers { get; init; } = [];
    public List<LlmModelConfig> Models { get; init; } = [];
    [JsonIgnore]
    public bool IsAiChatMode => string.Equals(Mode, LlmConnectionModes.AiChatApi, StringComparison.OrdinalIgnoreCase);
    [JsonIgnore]
    public bool HasAiChatAccount => !string.IsNullOrWhiteSpace(AiChat?.Account?.Email);
}
public sealed record LlmProviderConfig
{
    public string Id { get; init; } = "";
    public string Label { get; init; } = "";
    public string BaseUrl { get; init; } = "";
    public string? AuthRef { get; init; }
    public bool Enabled { get; init; } = true;
    public string Protocol { get; init; } = "openai-compatible";
}
public sealed record AiChatRuntimeConfig
@@ -177,6 +198,13 @@
    public string MemoryMode { get; init; } = "ISOLATED";
}
public sealed record AiChatProjectsResult
{
    public required string Status { get; init; }
    public string? Message { get; init; }
    public IReadOnlyList<AiChatProjectSummary> Projects { get; init; } = [];
}
public sealed record AiChatMemoryCapabilities
{
    public bool CanUseMemory { get; init; }