feat: add filepath to apply prompt template vars#7681
Merged
Conversation
|
|
||
| let overridePrompt: ChatMessage[] | undefined; | ||
| if (llm.promptTemplates?.apply) { | ||
| const filepath = getLastNPathParts(fileUri, 1); |
Contributor
There was a problem hiding this comment.
Using getLastNPathParts on a URI can yield incorrect results for non-file schemes and ignores URI encoding; use the URI-aware basename helper instead.
Prompt for AI agents
Address the following comment on extensions/vscode/src/diff/vertical/manager.ts at line 436:
<comment>Using getLastNPathParts on a URI can yield incorrect results for non-file schemes and ignores URI encoding; use the URI-aware basename helper instead.</comment>
<file context>
@@ -432,9 +433,11 @@ export class VerticalDiffManager {
let overridePrompt: ChatMessage[] | undefined;
if (llm.promptTemplates?.apply) {
+ const filepath = getLastNPathParts(fileUri, 1);
const rendered = llm.renderPromptTemplate(llm.promptTemplates.apply, [], {
original_code: rangeContent,
</file context>
Contributor
Author
|
🎉 This PR is included in version 1.13.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
can now use {{{ filepath }}} in promptTemplates for apply
Summary by cubic
Enable {{{ filepath }}} in apply prompt templates so prompts can adapt to the current file. We pass the last path segment from fileUri as "filepath" to renderPromptTemplate alongside original_code and new_code.