@@ -14,7 +14,7 @@ import { localize } from '../../../../../nls.js';
14
14
import { RawContextKey } from '../../../../../platform/contextkey/common/contextkey.js' ;
15
15
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js' ;
16
16
import { ResourceLabels } from '../../../../browser/labels.js' ;
17
- import { IChatRequestVariableEntry , isElementVariableEntry , isImageVariableEntry , isNotebookOutputVariableEntry , isPasteVariableEntry , isSCMHistoryItemVariableEntry } from '../../common/chatModel.js' ;
17
+ import { IChatRequestVariableEntry , isElementVariableEntry , isImageVariableEntry , isNotebookOutputVariableEntry , isPasteVariableEntry , isSCMHistoryItemVariableEntry , OmittedState } from '../../common/chatModel.js' ;
18
18
import { ChatResponseReferencePartStatusKind , IChatContentReference } from '../../common/chatService.js' ;
19
19
import { DefaultChatAttachmentWidget , ElementChatAttachmentWidget , FileAttachmentWidget , ImageAttachmentWidget , NotebookCellOutputChatAttachmentWidget , PasteAttachmentWidget , SCMHistoryItemAttachmentWidget , ToolSetOrToolItemAttachmentWidget } from '../chatAttachmentWidgets.js' ;
20
20
@@ -53,13 +53,16 @@ export class ChatAttachmentsContentPart extends Disposable {
53
53
const resource = URI . isUri ( attachment . value ) ? attachment . value : attachment . value && typeof attachment . value === 'object' && 'uri' in attachment . value && URI . isUri ( attachment . value . uri ) ? attachment . value . uri : undefined ;
54
54
const range = attachment . value && typeof attachment . value === 'object' && 'range' in attachment . value && Range . isIRange ( attachment . value . range ) ? attachment . value . range : undefined ;
55
55
const correspondingContentReference = this . contentReferences . find ( ( ref ) => ( typeof ref . reference === 'object' && 'variableName' in ref . reference && ref . reference . variableName === attachment . name ) || ( URI . isUri ( ref . reference ) && basename ( ref . reference . path ) === attachment . name ) ) ;
56
+ const isAttachmentOmitted = correspondingContentReference ?. options ?. status ?. kind === ChatResponseReferencePartStatusKind . Omitted ;
57
+ const isAttachmentPartialOrOmitted = isAttachmentOmitted || correspondingContentReference ?. options ?. status ?. kind === ChatResponseReferencePartStatusKind . Partial ;
56
58
57
59
let widget ;
58
60
if ( attachment . kind === 'tool' || attachment . kind === 'toolset' ) {
59
61
widget = this . instantiationService . createInstance ( ToolSetOrToolItemAttachmentWidget , attachment , undefined , { shouldFocusClearButton : false , supportsDeletion : false } , container , this . _contextResourceLabels , hoverDelegate ) ;
60
62
} else if ( isElementVariableEntry ( attachment ) ) {
61
63
widget = this . instantiationService . createInstance ( ElementChatAttachmentWidget , attachment , undefined , { shouldFocusClearButton : false , supportsDeletion : false } , container , this . _contextResourceLabels , hoverDelegate ) ;
62
64
} else if ( isImageVariableEntry ( attachment ) ) {
65
+ attachment . omittedState = isAttachmentPartialOrOmitted ? OmittedState . Full : attachment . omittedState ;
63
66
widget = this . instantiationService . createInstance ( ImageAttachmentWidget , resource , attachment , undefined , { shouldFocusClearButton : false , supportsDeletion : false } , container , this . _contextResourceLabels , hoverDelegate ) ;
64
67
} else if ( resource && ( attachment . kind === 'file' || attachment . kind === 'directory' ) ) {
65
68
widget = this . instantiationService . createInstance ( FileAttachmentWidget , resource , range , attachment , correspondingContentReference , undefined , { shouldFocusClearButton : false , supportsDeletion : false } , container , this . _contextResourceLabels , hoverDelegate ) ;
@@ -73,9 +76,6 @@ export class ChatAttachmentsContentPart extends Disposable {
73
76
widget = this . instantiationService . createInstance ( DefaultChatAttachmentWidget , resource , range , attachment , correspondingContentReference , undefined , { shouldFocusClearButton : false , supportsDeletion : false } , container , this . _contextResourceLabels , hoverDelegate ) ;
74
77
}
75
78
76
- const isAttachmentOmitted = correspondingContentReference ?. options ?. status ?. kind === ChatResponseReferencePartStatusKind . Omitted ;
77
- const isAttachmentPartialOrOmitted = isAttachmentOmitted || correspondingContentReference ?. options ?. status ?. kind === ChatResponseReferencePartStatusKind . Partial ;
78
-
79
79
let ariaLabel : string | null = null ;
80
80
81
81
if ( isAttachmentPartialOrOmitted ) {
0 commit comments