@@ -9,6 +9,7 @@ import { parseSessionLogs, parseToolCallDetails } from '../../../common/sessionP
99import { COPILOT_SWE_AGENT } from '../../common/copilot' ;
1010import Logger from '../../common/logger' ;
1111import { CommentEvent , CopilotFinishedEvent , CopilotStartedEvent , EventType , ReviewEvent , TimelineEvent } from '../../common/timelineEvent' ;
12+ import { toOpenPullRequestWebviewUri } from '../../common/uri' ;
1213import { InMemFileChangeModel , RemoteFileChangeModel } from '../../view/fileChangeModel' ;
1314import { AssistantDelta , Choice , ToolCall } from '../common' ;
1415import { CopilotApi , SessionInfo } from '../copilotApi' ;
@@ -53,6 +54,13 @@ export class ChatSessionContentBuilder {
5354 // Create response turn
5455 const responseHistory = await this . createResponseTurn ( pullRequest , logs , session ) ;
5556 if ( responseHistory ) {
57+ // if this is the first response, then also add the PR card
58+ if ( history . length === 1 ) {
59+ const uri = await toOpenPullRequestWebviewUri ( { owner : pullRequest . remote . owner , repo : pullRequest . remote . repositoryName , pullRequestNumber : pullRequest . number } ) ;
60+ const card = new vscode . ChatResponsePullRequestPart ( uri , pullRequest . title , pullRequest . body , pullRequest . author . specialDisplayName ?? pullRequest . author . login , `#${ pullRequest . number } ` ) ;
61+ const cardTurn = new vscode . ChatResponseTurn2 ( [ card ] , { } , COPILOT_SWE_AGENT ) ;
62+ history . push ( cardTurn ) ;
63+ }
5664 history . push ( responseHistory ) ;
5765 }
5866 }
0 commit comments