@@ -953,33 +953,35 @@ export class ChatSessionsService extends Disposable implements IChatSessionsServ
953953
954954 for ( let i = responseParts . length - 1 ; i >= 0 ; i -- ) {
955955 const part = responseParts [ i ] ;
956- if ( ! description && part . kind === 'confirmation' && typeof part . message === 'string' ) {
957- description = part . message ;
956+ if ( description ) {
957+ break ;
958958 }
959- if ( ! description && part . kind === 'toolInvocation' ) {
959+
960+ if ( part . kind === 'confirmation' && typeof part . message === 'string' ) {
961+ description = part . message ;
962+ } else if ( part . kind === 'toolInvocation' ) {
960963 const toolInvocation = part as IChatToolInvocation ;
961964 const state = toolInvocation . state . get ( ) ;
962965
963966 if ( state . type !== IChatToolInvocation . StateKind . Completed ) {
964- const pastTenseMessage = toolInvocation . pastTenseMessage ;
965- const invocationMessage = toolInvocation . invocationMessage ;
966- description = pastTenseMessage || invocationMessage ;
967+ description = toolInvocation . pastTenseMessage || toolInvocation . invocationMessage ;
967968
968969 if ( state . type === IChatToolInvocation . StateKind . WaitingForConfirmation ) {
969- const message = toolInvocation . confirmationMessages ?. title && ( typeof toolInvocation . confirmationMessages . title === 'string'
970- ? toolInvocation . confirmationMessages . title
971- : toolInvocation . confirmationMessages . title . value ) ;
972- description = message ?? localize ( 'chat.sessions.description.waitingForConfirmation' , "Waiting for confirmation: {0}" , typeof description === 'string' ? description : description . value ) ;
970+ const confirmationTitle = toolInvocation . confirmationMessages ?. title ;
971+ const titleMessage = confirmationTitle && ( typeof confirmationTitle === 'string'
972+ ? confirmationTitle
973+ : confirmationTitle . value ) ;
974+ const descriptionValue = typeof description === 'string' ? description : description . value ;
975+ description = titleMessage ?? localize ( 'chat.sessions.description.waitingForConfirmation' , "Waiting for confirmation: {0}" , descriptionValue ) ;
973976 }
974977 }
975- }
976- if ( ! description && part . kind === 'toolInvocationSerialized' ) {
978+ } else if ( part . kind === 'toolInvocationSerialized' ) {
977979 description = part . invocationMessage ;
978- }
979- if ( ! description && part . kind === 'progressMessage' ) {
980+ } else if ( part . kind === 'progressMessage' ) {
980981 description = part . content ;
981982 }
982983 }
984+
983985 return renderAsPlaintext ( description , { useLinkFormatter : true } ) ;
984986 }
985987
0 commit comments