Skip to content

Commit e65ec30

Browse files
Copilotalexr00
andauthored
Strip AI warning suffix from "Apply Suggestion Using AI" chat input (#8611)
* Initial plan * Initial plan for fixing AI warning suffix in applySuggestionWithCopilot Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/a47a6887-194e-4dd7-966a-3459c61cc24c * Fix: Use rawComment.body in applySuggestionWithCopilot to exclude AI warning suffix When applying a suggestion using AI for Copilot Code Review comments, the rendered comment body included the "Copilot is powered by AI, so mistakes are possible" suffix. Use rawComment.body instead to get the original comment text without the display-only warning. Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com> Agent-Logs-Url: https://github.com/microsoft/vscode-pull-request-github/sessions/a47a6887-194e-4dd7-966a-3459c61cc24c --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
1 parent 9a721c2 commit e65ec30

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/commands.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1848,9 +1848,10 @@ ${contents}
18481848

18491849
const isThread = GHPRCommentThread.is(comment);
18501850
const commentThread = isThread ? comment : comment.parent;
1851-
const commentBody = isThread ? comment.comments[0].body : comment.body;
1851+
const firstComment = isThread ? comment.comments[0] : comment;
18521852
commentThread.collapsibleState = vscode.CommentThreadCollapsibleState.Collapsed;
1853-
const message = commentBody instanceof vscode.MarkdownString ? commentBody.value : commentBody;
1853+
const message = firstComment instanceof GHPRComment ? firstComment.rawComment.body
1854+
: (firstComment.body instanceof vscode.MarkdownString ? firstComment.body.value : firstComment.body);
18541855

18551856
if (isThread) {
18561857
// For threads, open the Chat view instead of inline chat

0 commit comments

Comments
 (0)