Advanced Paste: AI pasting enhancement (#42374)

<!-- 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
* Add multiple endpoint support for paste with AI
* Add Local AI support for paste AI
* Advanced AI implementation

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [x] Closes: #32960
- [x] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [x] **Localization:** All end-user-facing strings can be localized
- [x] **Dev docs:** Added/updated
- [x] **New binaries:** Added on the required places
- [x] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [x] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [x] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [x] [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

### GPO
- [x] Paste with AI should not be available if the original GPO for
paste AI is set to false
   - [x] Paste with AI should be controlled within endpoint granularity
- [x] Advanced Paste UI should disable AI ability if GPO is set to
disable for any llm
### Paste AI
   - [x] Every AI endpoint should work as expected
   - [x] Default prompt should be able to give a reasonable result
   - [x] Local AI should work as expected
### Advanced AI
- [x] Open AI and Azure OPENAI should be able to configure as advanced
AI endpoint
- [x] Advanced AI should be able to pick up functions correctly to do
the transformation and give reasonable result

---------

Signed-off-by: Shawn Yuan <shuaiyuan@microsoft.com>
Signed-off-by: Shuai Yuan <shuai.yuan.zju@gmail.com>
Signed-off-by: Shawn Yuan (from Dev Box) <shuaiyuan@microsoft.com>
Co-authored-by: Leilei Zhang <leilzh@microsoft.com>
Co-authored-by: Niels Laute <niels.laute@live.nl>
Co-authored-by: Kai Tao <kaitao@microsoft.com>
Co-authored-by: Kai Tao <69313318+vanzue@users.noreply.github.com>
Co-authored-by: vanzue <vanzue@outlook.com>
Co-authored-by: Gordon Lam (SH) <yeelam@microsoft.com>
This commit is contained in:
Shawn Yuan
2025-11-05 16:13:55 +08:00
committed by GitHub
parent c364aa7c70
commit a3b8dc6cb8
119 changed files with 8441 additions and 958 deletions

View File

@@ -626,17 +626,120 @@ opera.exe</value>
<data name="AdvancedPaste_EnableAISettingsCard.Header" xml:space="preserve">
<value>Enable Paste with AI</value>
</data>
<data name="AdvancedPaste_EnableAIDialogMarkdown.Text" xml:space="preserve">
<value>## Preview Terms
Please review the placeholder content that represents the final terms and usage guidance for Advanced Paste.
1. This is sample information.
2. Real policy content will be provided later.
3. Continue only if you are comfortable with the above.</value>
</data>
<data name="AdvancedPaste_EnableAIDialogAcceptanceCheckBox.Content" xml:space="preserve">
<value>I have read and accept the information above.</value>
</data>
<data name="AdvancedPaste_EnableAdvancedAIModerationToggle.Content" xml:space="preserve">
<value>Enable OpenAI content moderation</value>
</data>
<data name="AdvancedPaste_EnablePasteAIModerationToggle.Header" xml:space="preserve">
<value>Enable OpenAI content moderation</value>
</data>
<data name="AdvancedPaste_EnableAdvancedAI_SettingsCard.Header" xml:space="preserve">
<value>Enable Advanced AI</value>
</data>
<data name="AdvancedPaste_EnableAdvancedAI_SettingsCard.Description" xml:space="preserve">
<value>Use built-in functions to handle complex tasks. Token consumption may increase.</value>
</data>
<data name="AdvancedPaste_Clipboard_History_Enabled_SettingsCard.Header" xml:space="preserve">
<value>Clipboard history</value>
<value>Access Clipboard History</value>
</data>
<data name="AdvancedPaste_Clipboard_History_Enabled_SettingsCard.Description" xml:space="preserve">
<value>Save multiple items to your clipboard. This is an OS feature.</value>
<value>Clipboard History shows a list of previously copied items.</value>
</data>
<data name="AdvancedPaste_Direct_Access_Hotkeys_GroupSettings.Header" xml:space="preserve">
<value>Actions</value>
</data>
<data name="AdvancedPaste_Additional_Actions_GroupSettings.Header" xml:space="preserve">
<value>Additional actions</value>
<value>Custom actions</value>
</data>
<data name="AdvancedPaste_FoundryLocal_LegalDescription" xml:space="preserve">
<value>You're running local models directly on your device. Their behavior may vary or be unpredictable.</value>
</data>
<data name="FoundryLocal_RestartRequiredNote.Text" xml:space="preserve">
<value>Note: After installing the Foundry Local CLI, restart PowerToys to use it.</value>
<comment>Message informing users that PowerToys needs to be restarted after installing Foundry Local CLI</comment>
</data>
<data name="AdvancedPaste_LocalModel_LegalDescription" xml:space="preserve">
<value>You're running local models directly on your device. Their behavior may vary or be unpredictable.</value>
</data>
<data name="AdvancedPaste_OpenAI_LegalDescription" xml:space="preserve">
<value>Your API key connects directly to OpenAI services. By setting up this provider, you agree to comply with OpenAI's usage policies and data handling practices.</value>
</data>
<data name="AdvancedPaste_OpenAI_TermsLabel" xml:space="preserve">
<value>Terms of Use</value>
</data>
<data name="AdvancedPaste_OpenAI_PrivacyLabel" xml:space="preserve">
<value>Privacy Policy</value>
</data>
<data name="AdvancedPaste_AzureOpenAI_LegalDescription" xml:space="preserve">
<value>Your API key connects directly to Microsoft Azure services. By setting up this provider, you agree to comply with Microsoft Azure's usage policies and data handling practices.</value>
</data>
<data name="AdvancedPaste_AzureOpenAI_TermsLabel" xml:space="preserve">
<value>Microsoft Azure Terms of Service</value>
</data>
<data name="AdvancedPaste_AzureOpenAI_PrivacyLabel" xml:space="preserve">
<value>Microsoft Privacy Statement</value>
</data>
<data name="AdvancedPaste_AzureAIInference_LegalDescription" xml:space="preserve">
<value>Your API key connects directly to Microsoft Azure services. By setting up this provider, you agree to comply with Microsoft Azure's usage policies and data handling practices.</value>
</data>
<data name="AdvancedPaste_AzureAIInference_TermsLabel" xml:space="preserve">
<value>Microsoft Azure Terms of Service</value>
</data>
<data name="AdvancedPaste_AzureAIInference_PrivacyLabel" xml:space="preserve">
<value>Microsoft Privacy Statement</value>
</data>
<data name="AdvancedPaste_Google_LegalDescription" xml:space="preserve">
<value>Your API key connects directly to Google services. By setting up this provider, you agree to comply with Google's usage policies and data handling practices.</value>
</data>
<data name="AdvancedPaste_Google_TermsLabel" xml:space="preserve">
<value>Google Terms of Service</value>
</data>
<data name="AdvancedPaste_Google_PrivacyLabel" xml:space="preserve">
<value>Google Privacy Policy</value>
</data>
<data name="AdvancedPaste_Anthropic_LegalDescription" xml:space="preserve">
<value>Your API key connects directly to Anthropic services. By setting up this provider, you agree to comply with Anthropic's usage policies and data handling practices.</value>
</data>
<data name="AdvancedPaste_Anthropic_TermsLabel" xml:space="preserve">
<value>Anthropic Terms of Service</value>
</data>
<data name="AdvancedPaste_Anthropic_PrivacyLabel" xml:space="preserve">
<value>Anthropic Privacy Policy</value>
</data>
<data name="AdvancedPaste_Mistral_LegalDescription" xml:space="preserve">
<value>Your API key connects directly to Mistral services. By setting up this provider, you agree to comply with Mistral's usage policies and data handling practices.</value>
</data>
<data name="AdvancedPaste_Mistral_TermsLabel" xml:space="preserve">
<value>Mistral Terms of Use</value>
</data>
<data name="AdvancedPaste_Mistral_PrivacyLabel" xml:space="preserve">
<value>Mistral Privacy Policy</value>
</data>
<data name="AdvancedPaste_AmazonBedrock_LegalDescription" xml:space="preserve">
<value>Your API key connects directly to Amazon services. By setting up this provider, you agree to comply with Amazon's usage policies and data handling practices.</value>
</data>
<data name="AdvancedPaste_AmazonBedrock_TermsLabel" xml:space="preserve">
<value>AWS Service Terms</value>
</data>
<data name="AdvancedPaste_AmazonBedrock_PrivacyLabel" xml:space="preserve">
<value>AWS Privacy Notice</value>
</data>
<data name="AdvancedPaste_Ollama_TermsLabel" xml:space="preserve">
<value>Ollama Terms of Service</value>
</data>
<data name="AdvancedPaste_Ollama_PrivacyLabel" xml:space="preserve">
<value>Ollama Privacy Policy</value>
</data>
<data name="RemapKeysList.[using:Microsoft.UI.Xaml.Automation]AutomationProperties.Name" xml:space="preserve">
<value>Current key remappings</value>
@@ -1956,6 +2059,9 @@ Made with 💗 by Microsoft and the PowerToys community.</value>
<data name="AdvancedPasteUI_CustomAction_Name.Header" xml:space="preserve">
<value>Name</value>
</data>
<data name="AdvancedPasteUI_CustomAction_Description.Header" xml:space="preserve">
<value>Description</value>
</data>
<data name="AdvancedPasteUI_CustomAction_Prompt.Header" xml:space="preserve">
<value>Prompt</value>
</data>
@@ -3301,7 +3407,7 @@ Activate by holding the key for the character you want to add an accent to, then
<value>An AI powered tool to put your clipboard content into any format you need, focused towards developer workflows.</value>
</data>
<data name="AdvancedPaste_EnableAISettingsCardDescription.Text" xml:space="preserve">
<value>This feature allows you to format your clipboard content with the power of AI. An OpenAI API key is required.</value>
<value>Transform your clipboard content with the power of AI. An cloud or local endpoint is required.</value>
</data>
<data name="AdvancedPaste_EnableAISettingsCardDescriptionLearnMore.Content" xml:space="preserve">
<value>Learn more</value>
@@ -3935,7 +4041,7 @@ Activate by holding the key for the character you want to add an accent to, then
<value>Paste with AI</value>
</data>
<data name="AdvancedPaste_BehaviorSettingsGroup.Header" xml:space="preserve">
<value>Behavior</value>
<value>Activation &amp; behavior</value>
</data>
<data name="AdvancedPaste_ShowCustomPreviewSettingsCard.Header" xml:space="preserve">
<value>Custom format preview</value>
@@ -3944,10 +4050,10 @@ Activate by holding the key for the character you want to add an accent to, then
<value>Preview the output of AI formats and Image to text before pasting</value>
</data>
<data name="AdvancedPaste_EnableAdvancedAI.Header" xml:space="preserve">
<value>Enable advanced AI</value>
<value>Advanced AI</value>
</data>
<data name="AdvancedPaste_EnableAdvancedAI.Description" xml:space="preserve">
<value>Add advanced capabilities when using 'Paste with AI' including the power to 'chain' multiple transformations together and work with images and files. This feature may consume more API credits when used.</value>
<value>Supports advanced workflows by chaining transformations and working with files and images. May use additional API credits.</value>
</data>
<data name="Oobe_AdvancedPaste.Description" xml:space="preserve">
<value>Advanced Paste is a tool to put your clipboard content into any format you need, focused towards developer workflows. It can paste as plain text, markdown, or json directly with the UX or with a direct keystroke invoke. These are fully locally executed. In addition, it has an AI powered option that is 100% opt-in and requires an Open AI key. Note: this will replace the formatted text in your clipboard with the selected format.</value>
@@ -4476,9 +4582,9 @@ Activate by holding the key for the character you want to add an accent to, then
<data name="AdvancedPaste_EnableAIDialog_NoteAICreditsErrorText.Text" xml:space="preserve">
<value>If you do not have credits you will see an 'API key quota exceeded' error</value>
</data>
<data name="AdvancedPaste_CloseAfterLosingFocus.Header" xml:space="preserve">
<value>Automatically close the AdvancedPaste window after it loses focus</value>
<comment>AdvancedPaste is a product name, do not loc</comment>
<data name="AdvancedPaste_CloseAfterLosingFocus.Content" xml:space="preserve">
<value>Automatically close the Advanced Paste window after it loses focus</value>
<comment>Advanced Paste is a product name, do not loc</comment>
</data>
<data name="GPO_CommandNotFound_ForceDisabled.Title" xml:space="preserve">
<value>The Command Not Found module is disabled by your organization.</value>