[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:
Ani
2024-12-11 10:28:44 +01:00
committed by GitHub
parent 474b0cfbdf
commit bf3474b134
75 changed files with 2589 additions and 937 deletions

View File

@@ -23,17 +23,16 @@ namespace Microsoft.PowerToys.Settings.UI.Library
PasteAsJsonShortcut = new();
CustomActions = new();
AdditionalActions = new();
IsAdvancedAIEnabled = false;
ShowCustomPreview = true;
SendPasteKeyCombination = true;
CloseAfterLosingFocus = false;
}
[JsonConverter(typeof(BoolPropertyJsonConverter))]
public bool ShowCustomPreview { get; set; }
public bool IsAdvancedAIEnabled { get; set; }
[JsonConverter(typeof(BoolPropertyJsonConverter))]
[CmdConfigureIgnore]
public bool SendPasteKeyCombination { get; set; }
public bool ShowCustomPreview { get; set; }
[JsonConverter(typeof(BoolPropertyJsonConverter))]
public bool CloseAfterLosingFocus { get; set; }

View File

@@ -53,16 +53,18 @@ namespace Microsoft.PowerToys.Settings.UI.Library.Utilities
return sendCustomAction.ToJsonString();
}
public static IFileSystemWatcher GetFileWatcher(string moduleName, string fileName, Action onChangedCallback)
public static IFileSystemWatcher GetFileWatcher(string moduleName, string fileName, Action onChangedCallback, IFileSystem fileSystem = null)
{
var path = FileSystem.Path.Combine(LocalApplicationDataFolder(), $"Microsoft\\PowerToys\\{moduleName}");
fileSystem ??= FileSystem;
if (!FileSystem.Directory.Exists(path))
var path = fileSystem.Path.Combine(LocalApplicationDataFolder(), $"Microsoft\\PowerToys\\{moduleName}");
if (!fileSystem.Directory.Exists(path))
{
FileSystem.Directory.CreateDirectory(path);
fileSystem.Directory.CreateDirectory(path);
}
var watcher = FileSystem.FileSystemWatcher.New();
var watcher = fileSystem.FileSystemWatcher.New();
watcher.Path = path;
watcher.Filter = fileName;
watcher.NotifyFilter = NotifyFilters.LastWrite;