File tree Expand file tree Collapse file tree
src/vs/workbench/contrib/chat/browser Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -404,12 +404,6 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
404404 } ) ;
405405
406406 this . initSelectedModel ( ) ;
407-
408- this . _register ( agentService . onDidChangeAgents ( ( ) => {
409- if ( ! agentService . hasToolsAgent && this . _currentMode === ChatMode . Agent ) {
410- this . setChatMode ( ChatMode . Edit ) ;
411- }
412- } ) ) ;
413407 }
414408
415409 private getSelectedModelStorageKey ( ) : string {
@@ -469,10 +463,6 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
469463 }
470464
471465 mode = validateChatMode ( mode ) ?? ( this . location === ChatAgentLocation . Panel ? ChatMode . Ask : ChatMode . Edit ) ;
472- if ( mode === ChatMode . Agent && ! this . agentService . hasToolsAgent ) {
473- mode = ChatMode . Edit ;
474- }
475-
476466 this . _currentMode = mode ;
477467 this . chatMode . set ( mode ) ;
478468 this . _onDidChangeCurrentChatMode . fire ( ) ;
@@ -714,6 +704,12 @@ export class ChatInputPart extends Disposable implements IHistoryNavigationWidge
714704 }
715705 }
716706
707+ validateCurrentMode ( ) : void {
708+ if ( ! this . agentService . hasToolsAgent && this . _currentMode === ChatMode . Agent ) {
709+ this . setChatMode ( ChatMode . Edit ) ;
710+ }
711+ }
712+
717713 // A funtion that filters out specifically the `value` property of the attachment.
718714 private getFilteredEntry ( query : string , inputState : IChatInputState ) : IChatHistoryEntry {
719715 const attachmentsWithoutImageValues = inputState . chatContextAttachments ?. map ( attachment => {
Original file line number Diff line number Diff line change @@ -1143,6 +1143,7 @@ export class ChatWidget extends Disposable implements IChatWidget {
11431143
11441144 this . chatService . cancelCurrentRequestForSession ( this . viewModel . sessionId ) ;
11451145
1146+ this . input . validateCurrentMode ( ) ;
11461147 const result = await this . chatService . sendRequest ( this . viewModel . sessionId , input , {
11471148 mode : this . inputPart . currentMode ,
11481149 userSelectedModelId : this . inputPart . currentLanguageModel ,
You can’t perform that action at this time.
0 commit comments