using System.Text.Json.Serialization; using MarketAlly.AIPlugin; using MarketAlly.AIPlugin.Conversation; namespace MarketAlly.GitCommitEditor.Options; /// /// Model information for display in settings UI /// public sealed class ModelDisplayInfo { public string ModelId { get; init; } = string.Empty; public string DisplayName { get; init; } = string.Empty; public string Tier { get; init; } = string.Empty; public decimal InputCostPer1MTokens { get; init; } public decimal OutputCostPer1MTokens { get; init; } public string Speed { get; init; } = string.Empty; /// /// Formatted display string for picker: "DisplayName (Tier) - $X.XX/1M" /// public string FormattedDisplay => $"{DisplayName} ({Tier}) - ${InputCostPer1MTokens:F2}/1M in"; public override string ToString() => FormattedDisplay; } /// /// AI configuration options. /// For provider/model discovery, use IModelProviderService instead of static methods. /// public sealed class AiOptions { [JsonIgnore] public string ApiKey { get; set; } = string.Empty; /// /// AI Provider: Claude, OpenAI, Gemini, Qwen /// public string Provider { get; set; } = "Claude"; /// /// Model name specific to the provider /// public string Model { get; set; } = ModelConstants.Claude.Sonnet4; public bool IncludeDiffContext { get; set; } = true; public int MaxDiffLines { get; set; } = 200; public int MaxTokens { get; set; } = 500; public int RateLimitDelayMs { get; set; } = 500; /// /// Parses a provider string to AIProvider enum. /// public static AIProvider ParseProvider(string? provider) { return provider?.ToLowerInvariant() switch { "claude" or "anthropic" => AIProvider.Claude, "openai" or "gpt" => AIProvider.OpenAI, "gemini" or "google" => AIProvider.Gemini, "qwen" or "alibaba" => AIProvider.Qwen, _ => AIProvider.Claude }; } }