From 4e5a2db985160d7fc78d45907482dd2abe338761 Mon Sep 17 00:00:00 2001 From: Shuai Yuan Date: Wed, 3 Sep 2025 16:18:47 +0800 Subject: [PATCH] Init and added simple ui change. Signed-off-by: Shuai Yuan --- .../AdvancedPasteAIServiceOption.cs | 16 + .../AdvancedPasteAIServiceParameter.cs | 29 ++ .../AdvancedPasteProperties.cs | 6 + .../SettingsXAML/Views/AdvancedPastePage.xaml | 45 ++ .../Views/AdvancedPastePage.xaml.cs | 6 + .../ViewModels/AdvancedPasteViewModel.cs | 456 ++++++++++++++++++ 6 files changed, 558 insertions(+) create mode 100644 src/settings-ui/Settings.UI.Library/AdvancedPasteAIServiceOption.cs create mode 100644 src/settings-ui/Settings.UI.Library/AdvancedPasteAIServiceParameter.cs diff --git a/src/settings-ui/Settings.UI.Library/AdvancedPasteAIServiceOption.cs b/src/settings-ui/Settings.UI.Library/AdvancedPasteAIServiceOption.cs new file mode 100644 index 0000000000..9390bed9a8 --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/AdvancedPasteAIServiceOption.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.Linq; +using System.Text.Json.Serialization; + +namespace Microsoft.PowerToys.Settings.UI.Library; + +public class AdvancedPasteAIServiceOption +{ + public string Id { get; set; } = string.Empty; + + public string DisplayName { get; set; } = string.Empty; +} diff --git a/src/settings-ui/Settings.UI.Library/AdvancedPasteAIServiceParameter.cs b/src/settings-ui/Settings.UI.Library/AdvancedPasteAIServiceParameter.cs new file mode 100644 index 0000000000..1ccd9d3eaa --- /dev/null +++ b/src/settings-ui/Settings.UI.Library/AdvancedPasteAIServiceParameter.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation +// The Microsoft Corporation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text.Json.Serialization; + +namespace Microsoft.PowerToys.Settings.UI.Library; + +public class AdvancedPasteAIServiceParameter : INotifyPropertyChanged +{ + public string Name { get; set; } + + public string DisplayName { get; set; } + + public string Type { get; set; } + + public string Description { get; set; } + + public object Value { get; set; } + + public event PropertyChangedEventHandler PropertyChanged; + + protected void OnPropertyChanged([CallerMemberName] string propertyName = null) + => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); +} diff --git a/src/settings-ui/Settings.UI.Library/AdvancedPasteProperties.cs b/src/settings-ui/Settings.UI.Library/AdvancedPasteProperties.cs index d40bd686d3..e0ec229d94 100644 --- a/src/settings-ui/Settings.UI.Library/AdvancedPasteProperties.cs +++ b/src/settings-ui/Settings.UI.Library/AdvancedPasteProperties.cs @@ -2,6 +2,7 @@ // The Microsoft Corporation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; @@ -26,6 +27,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library IsAdvancedAIEnabled = false; ShowCustomPreview = true; CloseAfterLosingFocus = false; + AIServiceConfiguration = new Dictionary(); } [JsonConverter(typeof(BoolPropertyJsonConverter))] @@ -57,6 +59,10 @@ namespace Microsoft.PowerToys.Settings.UI.Library [CmdConfigureIgnoreAttribute] public AdvancedPasteAdditionalActions AdditionalActions { get; init; } + [JsonPropertyName("ai-service-configuration")] + [CmdConfigureIgnoreAttribute] + public Dictionary AIServiceConfiguration { get; set; } + public override string ToString() => JsonSerializer.Serialize(this); } diff --git a/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml b/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml index 28a28bf0b5..a49c4d1ef4 100644 --- a/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml +++ b/src/settings-ui/Settings.UI/SettingsXAML/Views/AdvancedPastePage.xaml @@ -106,6 +106,51 @@ IsEnabled="{x:Bind ViewModel.IsOpenAIEnabled, Mode=OneWay}"> + + + + + + + + + + + + + + + + + + + + + + + +