Fix BYOK Quota exceeded caused by Intent Detection with Copilot model #228
+240
−12
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.
Fixes microsoft/vscode#251944
Issue
Currently, the intent detection is hard-coded to use the copilot gpt-4o-mini model. This is an issue when you have exceeded your chat quota.
This will result in either one of the two errors
This is caused after the BYOK Chat Request returns with a 200. The code will reset the copilot token, because it doesn't check that it originated from the Copilot API
This also causes unnecessary network requests
The second error I have seen (on possibly older versions of the plugin) is the Quota exceeded error
Solution
I have tried to fix it in a way that is extensible later on
With this MR there is an error message the first time a BYOK model is used

The button opens a quick pick
