@@ -609,24 +609,32 @@ export class ChatService extends Disposable implements IChatService {
609
609
const initVariableData : IChatRequestVariableData = { variables : [ ] } ;
610
610
request = chatRequest ?? model . addRequest ( parsedRequest , initVariableData , attempt , agent , command , options ?. confirmation , options ?. locationData , options ?. attachedContext , options ?. workingSet ) ;
611
611
612
- // Variables may have changed if the agent and slash command changed, so resolve them again even if we already had a chatRequest
613
- const variableData = await this . chatVariablesService . resolveVariables ( parsedRequest , request . attachedContext , model , progressCallback , token ) ;
614
- for ( const variable of variableData . variables ) {
615
- if ( request . workingSet && variable . isFile && URI . isUri ( variable . value ) ) {
616
- request . workingSet . push ( variable . value ) ;
612
+ let variableData : IChatRequestVariableData ;
613
+ let message : string ;
614
+ if ( chatRequest ) {
615
+ variableData = chatRequest . variableData ;
616
+ message = getPromptText ( request . message ) . message ;
617
+ } else {
618
+ variableData = await this . chatVariablesService . resolveVariables ( parsedRequest , request . attachedContext , model , progressCallback , token ) ;
619
+ for ( const variable of variableData . variables ) {
620
+ if ( request . workingSet && variable . isFile && URI . isUri ( variable . value ) ) {
621
+ request . workingSet . push ( variable . value ) ;
622
+ }
617
623
}
624
+ model . updateRequest ( request , variableData ) ;
625
+
626
+ const promptTextResult = getPromptText ( request . message ) ;
627
+ variableData = updateRanges ( variableData , promptTextResult . diff ) ; // TODO bit of a hack
628
+ message = promptTextResult . message ;
618
629
}
619
- model . updateRequest ( request , variableData ) ;
620
- const promptTextResult = getPromptText ( request . message ) ;
621
- const updatedVariableData = updateRanges ( variableData , promptTextResult . diff ) ; // TODO bit of a hack
622
630
623
631
return {
624
632
sessionId,
625
633
requestId : request . id ,
626
634
agentId : agent . id ,
627
- message : promptTextResult . message ,
635
+ message,
628
636
command : command ?. name ,
629
- variables : updatedVariableData ,
637
+ variables : variableData ,
630
638
enableCommandDetection,
631
639
isParticipantDetected,
632
640
attempt,
0 commit comments