mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 19:57:57 +01:00
[AdvancedPaste]Add Semantic Kernel opt-in to allow chaining of paste actions (#35902)
* [AdvancedPaste] Semantic Kernel support * Changed log-line with potentially sensitive info * Spellcheck issues * Various improvements for Semantic Kernel * Spellcheck issue * Refactored Clipboard routines * Added integration tests for KernelService * Extra telemetry for AdvancedPaste * Added 'Hotkey' suffix to AdvancedPaste_Settings telemetry event * Added IsSavedQuery * Added KernelQueryCache * Refactoring * Added KernelQueryCache to BugReportTool delete list * Added opt-n for Semantic Kernel * Fixed bug with KernelQueryCache * Ability to view last AI chat message on error * Improved kernel query cache * Used System.IO.Abstractions and improved tests * Fixed under-count of token usage * Used Semantic Kernel icon * Cleanup * Add missing EndProject line * Fix dependency version conflicts * Fix NOTICE.md * Correct place of SemanticKernel in NOTICE.md * Unlinked CustomPreview toggle from AI * Added Microsoft.Bcl.AsyncInterfaces dependency to AdvancedPaste * Fixed NOTICE.md order * Moved Custom Preview to behaviour section * Made Image to Text raise error on empty output * Added AIServiceBatchIntegrationTests * Updated AIServiceBatchIntegrationTests * Added prompt moderation * Moved GPO Infobar to better location
This commit is contained in:
@@ -319,6 +319,20 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsAdvancedAIEnabled
|
||||
{
|
||||
get => _advancedPasteSettings.Properties.IsAdvancedAIEnabled;
|
||||
set
|
||||
{
|
||||
if (value != _advancedPasteSettings.Properties.IsAdvancedAIEnabled)
|
||||
{
|
||||
_advancedPasteSettings.Properties.IsAdvancedAIEnabled = value;
|
||||
OnPropertyChanged(nameof(IsAdvancedAIEnabled));
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowCustomPreview
|
||||
{
|
||||
get => _advancedPasteSettings.Properties.ShowCustomPreview;
|
||||
@@ -422,10 +436,11 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
|
||||
{
|
||||
try
|
||||
{
|
||||
PasswordVault vault = new PasswordVault();
|
||||
PasswordCredential cred = new PasswordCredential("https://platform.openai.com/api-keys", "PowerToys_AdvancedPaste_OpenAIKey", password);
|
||||
PasswordVault vault = new();
|
||||
PasswordCredential cred = new("https://platform.openai.com/api-keys", "PowerToys_AdvancedPaste_OpenAIKey", password);
|
||||
vault.Add(cred);
|
||||
OnPropertyChanged(nameof(IsOpenAIEnabled));
|
||||
IsAdvancedAIEnabled = true; // new users should get Semantic Kernel benefits immediately
|
||||
NotifySettingsChanged();
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
Reference in New Issue
Block a user