mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-21 22:19:52 +01:00
Clean up unused providers for AdvancedPaste (#43433)
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Clean up unused providers for AdvancedPaste <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [x] Closes: #43429 - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
This commit is contained in:
@@ -10,10 +10,8 @@ using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.IO.Abstractions;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
using global::PowerToys.GPOWrapper;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
@@ -57,6 +55,16 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
private Func<string, int> SendConfigMSG { get; }
|
||||
|
||||
private static readonly HashSet<string> CustomActionNonPersistedProperties = new(StringComparer.Ordinal)
|
||||
{
|
||||
nameof(AdvancedPasteCustomAction.CanMoveUp),
|
||||
nameof(AdvancedPasteCustomAction.CanMoveDown),
|
||||
nameof(AdvancedPasteCustomAction.IsValid),
|
||||
nameof(AdvancedPasteCustomAction.HasConflict),
|
||||
nameof(AdvancedPasteCustomAction.Tooltip),
|
||||
nameof(AdvancedPasteCustomAction.SubActions),
|
||||
};
|
||||
|
||||
public AdvancedPasteViewModel(
|
||||
ISettingsUtils settingsUtils,
|
||||
ISettingsRepository<GeneralSettings> settingsRepository,
|
||||
@@ -558,11 +566,9 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
AIServiceType.OpenAI => "gpt-4",
|
||||
AIServiceType.AzureOpenAI => "gpt-4",
|
||||
AIServiceType.Mistral => "mistral-large-latest",
|
||||
AIServiceType.Google => "gemini-1.5-pro",
|
||||
AIServiceType.Google => "gemini-2.5-pro",
|
||||
AIServiceType.AzureAIInference => "gpt-4o-mini",
|
||||
AIServiceType.Ollama => "llama3",
|
||||
AIServiceType.Anthropic => "claude-3-5-sonnet",
|
||||
AIServiceType.AmazonBedrock => "anthropic.claude-3-haiku",
|
||||
_ => string.Empty,
|
||||
};
|
||||
}
|
||||
@@ -589,7 +595,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
AIServiceType.AzureAIInference => GPOWrapper.GetAllowedAdvancedPasteAzureAIInferenceValue(),
|
||||
AIServiceType.Mistral => GPOWrapper.GetAllowedAdvancedPasteMistralValue(),
|
||||
AIServiceType.Google => GPOWrapper.GetAllowedAdvancedPasteGoogleValue(),
|
||||
AIServiceType.Anthropic => GPOWrapper.GetAllowedAdvancedPasteAnthropicValue(),
|
||||
_ => GpoRuleConfigured.Unavailable,
|
||||
};
|
||||
|
||||
@@ -844,9 +849,6 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
"azureaiinference" => "https://azure.microsoft.com/products/ai-services/ai-inference",
|
||||
"mistral" => "https://console.mistral.ai/account/api-keys",
|
||||
"google" => "https://ai.google.dev/",
|
||||
"huggingface" => "https://huggingface.co/settings/tokens",
|
||||
"anthropic" => "https://console.anthropic.com/account/keys",
|
||||
"amazonbedrock" => "https://aws.amazon.com/bedrock/",
|
||||
"ollama" => "https://ollama.com/",
|
||||
_ => "https://platform.openai.com/api-keys",
|
||||
};
|
||||
@@ -1000,7 +1002,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
|
||||
private void OnCustomActionPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (typeof(AdvancedPasteCustomAction).GetProperty(e.PropertyName).GetCustomAttribute<JsonIgnoreAttribute>() == null)
|
||||
if (!string.IsNullOrEmpty(e.PropertyName) && !CustomActionNonPersistedProperties.Contains(e.PropertyName))
|
||||
{
|
||||
SaveCustomActions();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user