feat(chat): include page URL context when sending browser elements to copilot chat#298099
Open
stjepko-xyz wants to merge 2 commits intomicrosoft:mainfrom
Open
feat(chat): include page URL context when sending browser elements to copilot chat#298099stjepko-xyz wants to merge 2 commits intomicrosoft:mainfrom
stjepko-xyz wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds optional page URL context to “Add Element to Chat” so Copilot Chat can better understand which page/route a selected DOM element came from (Simple Browser + Integrated Browser).
Changes:
- Extends element attachment data structures to carry an optional
pageUrl. - Captures the current page URL via CDP (
Runtime.evaluate) when collecting element node data. - Surfaces the URL in the model context text and in the element attachment hover UI; adds a
chat.sendElementsToChat.attachURLsetting to toggle inclusion.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/vs/workbench/contrib/chat/common/attachments/chatVariableEntries.ts | Adds pageUrl?: string to element variable entries. |
| src/vs/workbench/contrib/chat/browser/chat.contribution.ts | Registers new chat.sendElementsToChat.attachURL configuration setting. |
| src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.ts | Includes Page URL: line in Simple Browser element context; populates pageUrl on the attachment entry. |
| src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentWidgets.ts | Adds a “PAGE URL” section to the element hover UI and enables rich hover when URL is present. |
| src/vs/workbench/contrib/browserView/electron-browser/browserEditor.ts | Includes page URL in Integrated Browser element context and passes through pageUrl on attachments. |
| src/vs/platform/browserElements/electron-main/nativeBrowserElementsMainService.ts | Retrieves page URL during node enrichment and returns it in element data. |
| src/vs/platform/browserElements/common/browserElements.ts | Adds pageUrl?: string to IElementData. |
src/vs/platform/browserElements/electron-main/nativeBrowserElementsMainService.ts
Outdated
Show resolved
Hide resolved
Author
|
@microsoft-github-policy-service agree |
…ng to chat context
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
When using the intergrated browser include the page URL as context when sending browser elements to Copilot Chat, so Copilot knows which route/page the element belongs to. See issue: #298025
Details
pageUrlfield toIElementDataandIElementVariableEntryinterfacesRuntime.evaluate('document.location.href')ingetNodeData(), inside the existing enrichment try/catch blockPage URL:in the context text sent to the model for both Simple Browser and Integrated Browserchat.sendElementsToChat.attachURLsetting (default:true, tag:preview) to make URL inclusion optional, matching the pattern ofattachCSSandattachImagesResults
How to test
Page URL: <url>chat.sendElementsToChat.attachURLin settings, select another element, and verify the URLis no longer included