@@ -10,7 +10,7 @@ import { renderLabelWithIcons } from '../../../../base/browser/ui/iconLabel/icon
10
10
import { IAction } from '../../../../base/common/actions.js' ;
11
11
import { isNonEmptyArray , tail } from '../../../../base/common/arrays.js' ;
12
12
import { Emitter , Event } from '../../../../base/common/event.js' ;
13
- import { IMarkdownString , MarkdownString } from '../../../../base/common/htmlContent.js' ;
13
+ import { IMarkdownString } from '../../../../base/common/htmlContent.js' ;
14
14
import { DisposableStore , MutableDisposable , toDisposable } from '../../../../base/common/lifecycle.js' ;
15
15
import { constObservable , derived , ISettableObservable , observableValue } from '../../../../base/common/observable.js' ;
16
16
import './media/inlineChat.css' ;
@@ -45,10 +45,9 @@ import { MarkUnhelpfulActionId } from '../../chat/browser/actions/chatTitleActio
45
45
import { IChatWidgetViewOptions } from '../../chat/browser/chat.js' ;
46
46
import { ChatVoteDownButton } from '../../chat/browser/chatListRenderer.js' ;
47
47
import { ChatWidget , IChatWidgetLocationOptions } from '../../chat/browser/chatWidget.js' ;
48
- import { ChatAgentLocation } from '../../chat/common/chatAgents.js' ;
49
48
import { chatRequestBackground } from '../../chat/common/chatColors.js' ;
50
49
import { CONTEXT_CHAT_RESPONSE_SUPPORT_ISSUE_REPORTING , CONTEXT_RESPONSE , CONTEXT_RESPONSE_ERROR , CONTEXT_RESPONSE_FILTERED , CONTEXT_RESPONSE_VOTE } from '../../chat/common/chatContextKeys.js' ;
51
- import { ChatModel , IChatModel } from '../../chat/common/chatModel.js' ;
50
+ import { IChatModel } from '../../chat/common/chatModel.js' ;
52
51
import { ChatAgentVoteDirection , IChatService } from '../../chat/common/chatService.js' ;
53
52
import { isResponseVM } from '../../chat/common/chatViewModel.js' ;
54
53
import { HunkInformation , Session } from './inlineChatSession.js' ;
@@ -107,7 +106,6 @@ export class InlineChatWidget {
107
106
108
107
protected readonly _store = new DisposableStore ( ) ;
109
108
110
- private readonly _defaultChatModel : ChatModel ;
111
109
private readonly _ctxInputEditorFocused : IContextKey < boolean > ;
112
110
private readonly _ctxResponseFocused : IContextKey < boolean > ;
113
111
@@ -287,13 +285,6 @@ export class InlineChatWidget {
287
285
this . updateStatus ( 'Thank you for your feedback!' , { resetAfter : 1250 } ) ;
288
286
}
289
287
} ) ) ;
290
-
291
- // LEGACY - default chat model
292
- // this is only here for as long as we offer updateChatMessage
293
- this . _defaultChatModel = this . _store . add ( this . _instantiationService . createInstance ( ChatModel , undefined , ChatAgentLocation . Editor ) ) ;
294
- this . _defaultChatModel . startInitialize ( ) ;
295
- this . _defaultChatModel . initialize ( undefined ) ;
296
- this . setChatModel ( this . _defaultChatModel ) ;
297
288
}
298
289
299
290
private _updateAriaLabel ( ) : void {
@@ -452,57 +443,14 @@ export class InlineChatWidget {
452
443
}
453
444
454
445
455
- getChatModel ( ) : IChatModel {
456
- return this . _chatWidget . viewModel ?. model ?? this . _defaultChatModel ;
446
+ getChatModel ( ) : IChatModel | undefined {
447
+ return this . _chatWidget . viewModel ?. model ;
457
448
}
458
449
459
450
setChatModel ( chatModel : IChatModel ) {
460
451
this . _chatWidget . setModel ( chatModel , { inputValue : undefined } ) ;
461
452
}
462
453
463
- /**
464
- * @deprecated use `setChatModel` instead
465
- */
466
- updateChatMessage ( message : IInlineChatMessage , isIncomplete : true ) : IInlineChatMessageAppender ;
467
- updateChatMessage ( message : IInlineChatMessage | undefined ) : void ;
468
- updateChatMessage ( message : IInlineChatMessage | undefined , isIncomplete ?: boolean , isCodeBlockEditable ?: boolean ) : IInlineChatMessageAppender | undefined ;
469
- updateChatMessage ( message : IInlineChatMessage | undefined , isIncomplete ?: boolean , isCodeBlockEditable ?: boolean ) : IInlineChatMessageAppender | undefined {
470
-
471
- if ( ! this . _chatWidget . viewModel || this . _chatWidget . viewModel . model !== this . _defaultChatModel ) {
472
- // this can only be used with the default chat model
473
- return ;
474
- }
475
-
476
- const model = this . _defaultChatModel ;
477
- if ( ! message ?. message . value ) {
478
- for ( const request of model . getRequests ( ) ) {
479
- model . removeRequest ( request . id ) ;
480
- }
481
- return ;
482
- }
483
-
484
- const chatRequest = model . addRequest ( { parts : [ ] , text : '' } , { variables : [ ] } , 0 ) ;
485
- model . acceptResponseProgress ( chatRequest , {
486
- kind : 'markdownContent' ,
487
- content : message . message
488
- } ) ;
489
-
490
- if ( ! isIncomplete ) {
491
- model . completeResponse ( chatRequest ) ;
492
- return ;
493
- }
494
- return {
495
- cancel : ( ) => model . cancelRequest ( chatRequest ) ,
496
- complete : ( ) => model . completeResponse ( chatRequest ) ,
497
- appendContent : ( fragment : string ) => {
498
- model . acceptResponseProgress ( chatRequest , {
499
- kind : 'markdownContent' ,
500
- content : new MarkdownString ( fragment )
501
- } ) ;
502
- }
503
- } ;
504
- }
505
-
506
454
updateInfo ( message : string ) : void {
507
455
this . _elements . infoLabel . classList . toggle ( 'hidden' , ! message ) ;
508
456
const renderedMessage = renderLabelWithIcons ( message ) ;
@@ -541,16 +489,13 @@ export class InlineChatWidget {
541
489
reset ( ) {
542
490
this . _chatWidget . setContext ( true ) ;
543
491
this . _chatWidget . saveState ( ) ;
544
- this . updateChatMessage ( undefined ) ;
545
492
546
493
reset ( this . _elements . statusLabel ) ;
547
494
this . _elements . statusLabel . classList . toggle ( 'hidden' , true ) ;
548
495
this . _elements . toolbar1 . classList . add ( 'hidden' ) ;
549
496
this . _elements . toolbar2 . classList . add ( 'hidden' ) ;
550
497
this . updateInfo ( '' ) ;
551
498
552
- this . chatWidget . setModel ( this . _defaultChatModel , { } ) ;
553
-
554
499
this . _elements . accessibleViewer . classList . toggle ( 'hidden' , true ) ;
555
500
this . _onDidChangeHeight . fire ( ) ;
556
501
}
0 commit comments