feat: support workspace variable interpolation in Provider Custom Headers#11166
Draft
roomote[bot] wants to merge 1 commit intomainfrom
Draft
feat: support workspace variable interpolation in Provider Custom Headers#11166roomote[bot] wants to merge 1 commit intomainfrom
roomote[bot] wants to merge 1 commit intomainfrom
Conversation
…ders
- Add interpolateHeaders function to src/utils/config.ts
- Supports ${workspaceFolder}, ${workspaceFolderBasename}, and ${env:VAR_NAME}
- Integrate into buildApiHandler for all API providers
- Update getOpenAiModels to interpolate headers when fetching models
- Add comprehensive tests for the new functionality
Closes #11165
Open
2 tasks
Contributor
Author
Review complete. No issues found. The implementation correctly adds support for VS Code variable interpolation in Provider Custom Headers. The Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
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
This PR attempts to address Issue #11165 by adding support for VS Code variable interpolation in Provider Custom Headers.
Changes
New Features
interpolateHeadersfunction tosrc/utils/config.tsthat supports:${workspaceFolder}- Full path to the workspace root${workspaceFolderBasename}- Just the folder name (e.g.,my-repo-name)${env:VAR_NAME}- Environment variablesIntegration Points
buildApiHandler(src/api/index.ts) so all providers benefit automaticallygetOpenAiModelsfunction to interpolate headers when fetching modelsTests
interpolateHeadersfunction covering:Usage Example
After this change, users can configure a custom header like:
And when working in a project at
/home/user/projects/my-awesome-app, the actual header sent would be:Related Issues
Closes #11165
Feedback
Feedback and guidance are welcome!
Important
Add support for VS Code variable interpolation in provider custom headers via
interpolateHeadersfunction.interpolateHeadersfunction inconfig.tsto support${workspaceFolder},${workspaceFolderBasename}, and${env:VAR_NAME}in headers.interpolateHeadersinbuildApiHandlerinindex.tsandgetOpenAiModelsinopenai.tsfor automatic header interpolation.interpolateHeadersinconfig.spec.tscovering variable interpolation, environment variables, mixed variables, and edge cases.This description was created by
for f9abbd1. You can customize this summary. It will automatically update as commits are pushed.