feat: make Windows AI API hardware requirement message dynamic per API#615
Merged
Conversation
The "Copilot+ PC required" text was a static string from when WCR APIs were NPU-only. Phi Silica (and language-model skills), Speech Recognition, and Video Super Resolution now also run on GPU/CPU, so the message is derived per API instead. - Add SupportedHardwareAccelerators + SupportedHardwareUrl to apis.json / ApiDefinition; WcrApiHelpers.GetHardwareRequirementInfo derives the requirement sentence (NPU-only, +GPU, +CPU, or none when CPU+GPU both) and per-API supported-hardware link - Drop hardcoded Copilot+ PC build number; update download, error, and unavailable surfaces to show/hide the requirement dynamically - Add WcrApiConfigurationTests for the derived requirement + URLs
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Windows AI API model download/unavailable UX so the “hardware requirement” message and “Learn more” link are derived per-API from definition metadata (instead of a single hardcoded Copilot+ PC + build requirement), and wires that metadata through the source generator into ApiDefinition.
Changes:
- Added
SupportedHardwareAccelerators+SupportedHardwareUrlto Windows AI API definitions (apis.json) and surfaced them via the source generator ontoApiDefinition. - Implemented
WcrApiHelpers.GetHardwareRequirementInfoand integrated it into compatibility messaging and the downloader/unavailable surfaces. - Added unit tests validating the derived requirement sentences and per-API “Learn more” URLs.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| AIDevGallery/Samples/Definitions/WcrApis/WcrApiHelpers.cs | Adds per-API hardware requirement/learn-more derivation helper. |
| AIDevGallery/Samples/Definitions/WcrApis/apis.json | Declares supported hardware + doc URLs for select APIs. |
| AIDevGallery/Models/Samples.cs | Extends runtime ApiDefinition with supported hardware metadata. |
| AIDevGallery/Models/ModelCompatibility.cs | Uses derived hardware requirement in incompatibility messaging. |
| AIDevGallery/Controls/WcrModelUnavailable.xaml.cs | Updates default unavailable title/message copy. |
| AIDevGallery/Controls/WcrModelDownloader.xaml.cs | Sets requirement text/link and toggles visibility dynamically. |
| AIDevGallery/Controls/WcrModelDownloader.xaml | Splits requirement into a dedicated TextBlock/Hyperlink for dynamic updates. |
| AIDevGallery/Controls/SampleContainer.xaml.cs | Hooks “Learn more” URI to per-API supported-hardware docs for incompatible WCR APIs. |
| AIDevGallery.Tests/UnitTests/WcrApiConfigurationTests.cs | Adds tests for requirement sentence derivation + URL validity. |
| AIDevGallery.SourceGenerator/ModelsSourceGenerator.cs | Emits new supported hardware fields into generated ApiDefinitionDetails. |
| AIDevGallery.SourceGenerator/Models/ApiDefinition.cs | Extends source-generator model to parse/hold supported hardware metadata. |
Comment on lines
+245
to
+251
| var requirement = (runsOnGpu, runsOnCpu) switch | ||
| { | ||
| (true, true) => string.Empty, | ||
| (true, false) => CopilotPlusOrGpuRequirement, | ||
| (false, true) => CopilotPlusOrCpuRequirement, | ||
| _ => DefaultHardwareRequirement, | ||
| }; |
| var statusDescription = WcrApiHelpers.GetStringDescription(apiType, availbility); | ||
| description = string.IsNullOrEmpty(hardwareRequirement) | ||
| ? statusDescription | ||
| : $"{hardwareRequirement}\n {statusDescription}"; |
weiyuanyue
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The model-download/unavailable screens for Windows AI APIs showed a static "A Copilot+ PC with Windows 11 Build 26120.3073 or higher is required" message. That text dates from when all WCR APIs were NPU-only. Several APIs now also run off the NPU — Phi Silica & the language-model skills on GPU; Speech Recognition and Video Super Resolution on CPU — so a Copilot+ PC-only message is misleading.
What changed
SupportedHardwareAccelerators(enum array, e.g.["NPU","GPU"]) and aSupportedHardwareUrl, surfaced through the source generator ontoApiDefinition.WcrApiHelpers.GetHardwareRequirementInfoderives the requirement sentence per API.Tests
Added
WcrApiConfigurationTestscovering the derived GPU/CPU sentences, NPU-only fallback, and valid per-API URLs.