Skip to content

Commit 792a6c1

Browse files
committed
Remove request pause functionality from chat components
1 parent 951d731 commit 792a6c1

13 files changed

Lines changed: 26 additions & 198 deletions

File tree

src/vs/workbench/api/browser/mainThreadChatAgents2.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,6 @@ export class MainThreadChatAgents2 extends Disposable implements MainThreadChatA
177177
setRequestTools: (requestId, tools) => {
178178
this._proxy.$setRequestTools(requestId, tools);
179179
},
180-
setRequestPaused: (requestId, isPaused) => {
181-
this._proxy.$setRequestPaused(handle, requestId, isPaused);
182-
},
183180
provideFollowups: async (request, result, history, token): Promise<IChatFollowup[]> => {
184181
if (!this._agents.get(handle)?.hasFollowups) {
185182
return [];

src/vs/workbench/api/common/extHost.protocol.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,6 @@ export type IChatAgentHistoryEntryDto = {
13641364

13651365
export interface ExtHostChatAgentsShape2 {
13661366
$invokeAgent(handle: number, request: Dto<IChatAgentRequest>, context: { history: IChatAgentHistoryEntryDto[] }, token: CancellationToken): Promise<IChatAgentResult | undefined>;
1367-
$setRequestPaused(handle: number, requestId: string, isPaused: boolean): void;
13681367
$provideFollowups(request: Dto<IChatAgentRequest>, handle: number, result: IChatAgentResult, context: { history: IChatAgentHistoryEntryDto[] }, token: CancellationToken): Promise<IChatFollowup[]>;
13691368
$acceptFeedback(handle: number, result: IChatAgentResult, voteAction: IChatVoteAction): void;
13701369
$acceptAction(handle: number, result: IChatAgentResult, action: IChatUserActionEvent): void;

src/vs/workbench/api/common/extHostChatAgents2.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -527,19 +527,6 @@ export class ExtHostChatAgents2 extends Disposable implements ExtHostChatAgentsS
527527
return model;
528528
}
529529

530-
async $setRequestPaused(handle: number, requestId: string, isPaused: boolean) {
531-
const agent = this._agents.get(handle);
532-
if (!agent) {
533-
return;
534-
}
535-
536-
const inFlight = Iterable.find(this._inFlightRequests, r => r.requestId === requestId);
537-
if (!inFlight) {
538-
return;
539-
}
540-
541-
agent.setChatRequestPauseState({ request: inFlight.extRequest, isPaused });
542-
}
543530

544531
async $setRequestTools(requestId: string, tools: Pick<IChatAgentRequest, 'userSelectedTools'>) {
545532
const request = [...this._inFlightRequests].find(r => r.requestId === requestId);

src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.ts

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ abstract class SubmitAction extends Action2 {
150150
}
151151
}
152152

153-
const whenNotInProgressOrPaused = ContextKeyExpr.or(ChatContextKeys.isRequestPaused, ChatContextKeys.requestInProgress.negate());
153+
const whenNotInProgress = ChatContextKeys.requestInProgress.negate();
154154

155155
export class ChatSubmitAction extends SubmitAction {
156156
static readonly ID = 'workbench.action.chat.submit';
@@ -185,7 +185,7 @@ export class ChatSubmitAction extends SubmitAction {
185185
id: MenuId.ChatExecute,
186186
order: 4,
187187
when: ContextKeyExpr.and(
188-
whenNotInProgressOrPaused,
188+
whenNotInProgress,
189189
menuCondition,
190190
),
191191
group: 'navigation',
@@ -411,17 +411,14 @@ export class ChatEditingSessionSubmitAction extends SubmitAction {
411411
{
412412
id: MenuId.ChatExecuteSecondary,
413413
group: 'group_1',
414-
when: ContextKeyExpr.and(whenNotInProgressOrPaused, menuCondition),
414+
when: ContextKeyExpr.and(whenNotInProgress, menuCondition),
415415
order: 1
416416
},
417417
{
418418
id: MenuId.ChatExecute,
419419
order: 4,
420420
when: ContextKeyExpr.and(
421-
ContextKeyExpr.or(
422-
ContextKeyExpr.and(ChatContextKeys.isRequestPaused, ChatContextKeys.inputHasText),
423-
ChatContextKeys.requestInProgress.negate(),
424-
),
421+
ChatContextKeys.requestInProgress.negate(),
425422
menuCondition),
426423
group: 'navigation',
427424
}]
@@ -437,7 +434,7 @@ class SubmitWithoutDispatchingAction extends Action2 {
437434
// if the input has prompt instructions attached, allow submitting requests even
438435
// without text present - having instructions is enough context for a request
439436
ContextKeyExpr.or(ChatContextKeys.inputHasText, ChatContextKeys.hasPromptFile),
440-
whenNotInProgressOrPaused,
437+
whenNotInProgress,
441438
ChatContextKeys.chatModeKind.isEqualTo(ChatModeKind.Ask),
442439
);
443440

@@ -483,7 +480,7 @@ export class CreateRemoteAgentJobAction extends Action2 {
483480
constructor() {
484481
const precondition = ContextKeyExpr.and(
485482
ContextKeyExpr.or(ChatContextKeys.inputHasText, ChatContextKeys.hasPromptFile),
486-
whenNotInProgressOrPaused,
483+
whenNotInProgress,
487484
ChatContextKeys.remoteJobCreating.negate(),
488485
);
489486

@@ -685,7 +682,7 @@ export class ChatSubmitWithCodebaseAction extends Action2 {
685682
// if the input has prompt instructions attached, allow submitting requests even
686683
// without text present - having instructions is enough context for a request
687684
ContextKeyExpr.or(ChatContextKeys.inputHasText, ChatContextKeys.hasPromptFile),
688-
whenNotInProgressOrPaused,
685+
whenNotInProgress,
689686
);
690687

691688
super({
@@ -742,7 +739,7 @@ class SendToNewChatAction extends Action2 {
742739
// if the input has prompt instructions attached, allow submitting requests even
743740
// without text present - having instructions is enough context for a request
744741
ContextKeyExpr.or(ChatContextKeys.inputHasText, ChatContextKeys.hasPromptFile),
745-
whenNotInProgressOrPaused,
742+
whenNotInProgress,
746743
);
747744

748745
super({
@@ -803,7 +800,6 @@ export class CancelAction extends Action2 {
803800
menu: [{
804801
id: MenuId.ChatExecute,
805802
when: ContextKeyExpr.and(
806-
ChatContextKeys.isRequestPaused.negate(),
807803
ChatContextKeys.requestInProgress,
808804
ChatContextKeys.remoteJobCreating.negate()
809805
),

src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.ts

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { $, addDisposableListener, append, EventType } from '../../../../../base/browser/dom.js';
6+
import { $, append } from '../../../../../base/browser/dom.js';
77
import { alert } from '../../../../../base/browser/ui/aria/aria.js';
88
import { Codicon } from '../../../../../base/common/codicons.js';
9-
import { MarkdownString } from '../../../../../base/common/htmlContent.js';
109
import { Disposable } from '../../../../../base/common/lifecycle.js';
1110
import { ThemeIcon } from '../../../../../base/common/themables.js';
1211
import { MarkdownRenderer } from '../../../../../editor/browser/widget/markdownRenderer/browser/markdownRenderer.js';
13-
import { localize } from '../../../../../nls.js';
1412
import { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';
1513
import { IChatProgressMessage, IChatTask, IChatTaskSerialized } from '../../common/chatService.js';
16-
import { IChatRendererContent, IChatWorkingProgress, isResponseVM } from '../../common/chatViewModel.js';
14+
import { IChatRendererContent, isResponseVM } from '../../common/chatViewModel.js';
1715
import { ChatTreeItem } from '../chat.js';
1816
import { renderFileWidgets } from '../chatInlineAnchorWidget.js';
1917
import { IChatContentPart, IChatContentPartRenderContext } from './chatContentParts.js';
@@ -80,35 +78,6 @@ function shouldShowSpinner(followingContent: IChatRendererContent[], element: Ch
8078
return isResponseVM(element) && !element.isComplete && followingContent.length === 0;
8179
}
8280

83-
export class ChatWorkingProgressContentPart extends ChatProgressContentPart implements IChatContentPart {
84-
constructor(
85-
private readonly workingProgress: IChatWorkingProgress,
86-
renderer: MarkdownRenderer,
87-
context: IChatContentPartRenderContext,
88-
@IInstantiationService instantiationService: IInstantiationService,
89-
@IChatMarkdownAnchorService chatMarkdownAnchorService: IChatMarkdownAnchorService,
90-
) {
91-
const progressMessage: IChatProgressMessage = {
92-
kind: 'progressMessage',
93-
content: workingProgress.isPaused ?
94-
new MarkdownString().appendText(localize('pausedMessage', "Paused")) :
95-
new MarkdownString().appendText(localize('workingMessage', "Working..."))
96-
};
97-
super(progressMessage, renderer, context, undefined, undefined, workingProgress.isPaused ? Codicon.debugPause : undefined, instantiationService, chatMarkdownAnchorService);
98-
99-
if (workingProgress.isPaused) {
100-
this.domNode.style.cursor = 'pointer';
101-
this.domNode.title = localize('resume', "Click to resume");
102-
this._register(addDisposableListener(this.domNode, EventType.CLICK, () => {
103-
workingProgress.setPaused(false);
104-
}));
105-
}
106-
}
107-
108-
override hasSameContent(other: IChatRendererContent, followingContent: IChatRendererContent[], element: ChatTreeItem): boolean {
109-
return other.kind === 'working' && this.workingProgress.isPaused === other.isPaused;
110-
}
111-
}
11281

11382
export class ChatCustomProgressPart {
11483
public readonly domNode: HTMLElement;

src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,6 @@ class ChatEditorOverlayWidget extends Disposable {
7676
return { message: localize('working', "Working...") };
7777
}
7878

79-
if (response.isPaused.read(r)) {
80-
return { message: localize('paused', "Paused"), paused: true };
81-
}
82-
8379
const lastPart = observableFromEventOpts({ equalsFn: arrays.equals }, response.onDidChange, () => response.response.value)
8480
.read(r)
8581
.filter(part => part.kind === 'progressMessage' || part.kind === 'toolInvocation')
@@ -105,7 +101,7 @@ class ChatEditorOverlayWidget extends Disposable {
105101

106102
this._store.add(autorun(r => {
107103
const value = requestMessage.read(r);
108-
const busy = this._isBusy.read(r) && !value?.paused;
104+
const busy = this._isBusy.read(r);
109105

110106
this._domNode.classList.toggle('busy', busy);
111107

src/vs/workbench/contrib/chat/browser/chatListRenderer.ts

Lines changed: 5 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { IListElementRenderDetails, IListVirtualDelegate } from '../../../../bas
1313
import { ITreeNode, ITreeRenderer } from '../../../../base/browser/ui/tree/tree.js';
1414
import { IAction } from '../../../../base/common/actions.js';
1515
import { coalesce, distinct } from '../../../../base/common/arrays.js';
16-
import { findLast } from '../../../../base/common/arraysFind.js';
1716
import { Codicon } from '../../../../base/common/codicons.js';
1817
import { toErrorMessage } from '../../../../base/common/errorMessage.js';
1918
import { Emitter, Event } from '../../../../base/common/event.js';
@@ -50,7 +49,7 @@ import { ChatContextKeys } from '../common/chatContextKeys.js';
5049
import { IChatTextEditGroup } from '../common/chatModel.js';
5150
import { chatSubcommandLeader } from '../common/chatParserTypes.js';
5251
import { ChatAgentVoteDirection, ChatAgentVoteDownReason, ChatErrorLevel, IChatChangesSummary, IChatConfirmation, IChatContentReference, IChatElicitationRequest, IChatExtensionsContent, IChatFollowup, IChatMarkdownContent, IChatPullRequestContent, IChatMultiDiffData, IChatTask, IChatTaskSerialized, IChatToolInvocation, IChatToolInvocationSerialized, IChatTreeData, IChatUndoStop, IChatThinkingPart } from '../common/chatService.js';
53-
import { IChatChangesSummaryPart, IChatCodeCitations, IChatErrorDetailsPart, IChatReferences, IChatRendererContent, IChatRequestViewModel, IChatResponseViewModel, IChatViewModel, IChatWorkingProgress, isRequestVM, isResponseVM } from '../common/chatViewModel.js';
52+
import { IChatChangesSummaryPart, IChatCodeCitations, IChatErrorDetailsPart, IChatReferences, IChatRendererContent, IChatRequestViewModel, IChatResponseViewModel, IChatViewModel, isRequestVM, isResponseVM } from '../common/chatViewModel.js';
5453
import { getNWords } from '../common/chatWordCounter.js';
5554
import { CodeBlockModelCollection } from '../common/codeBlockModelCollection.js';
5655
import { ChatAgentLocation, ChatConfiguration, ChatModeKind } from '../common/constants.js';
@@ -66,7 +65,7 @@ import { IChatContentPart, IChatContentPartRenderContext } from './chatContentPa
6665
import { ChatErrorConfirmationContentPart } from './chatContentParts/chatErrorConfirmationPart.js';
6766
import { ChatExtensionsContentPart } from './chatContentParts/chatExtensionsContentPart.js';
6867
import { ChatMarkdownContentPart, EditorPool } from './chatContentParts/chatMarkdownContentPart.js';
69-
import { ChatProgressContentPart, ChatWorkingProgressContentPart } from './chatContentParts/chatProgressContentPart.js';
68+
import { ChatProgressContentPart } from './chatContentParts/chatProgressContentPart.js';
7069
import { ChatQuotaExceededPart } from './chatContentParts/chatQuotaExceededPart.js';
7170
import { ChatCollapsibleListContentPart, ChatUsedReferencesListContentPart, CollapsibleListPool } from './chatContentParts/chatReferencesContentPart.js';
7271
import { ChatTaskContentPart } from './chatContentParts/chatTaskContentPart.js';
@@ -254,7 +253,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
254253
const minAfterComplete = 80;
255254

256255
const rate = element.contentUpdateTimings?.impliedWordLoadRate;
257-
if (element.isComplete || element.isPaused.get()) {
256+
if (element.isComplete) {
258257
if (typeof rate === 'number') {
259258
return clamp(rate, minAfterComplete, Rate.Max);
260259
} else {
@@ -540,7 +539,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
540539
templateData.rowContainer.classList.toggle('interactive-request', isRequestVM(element));
541540
templateData.rowContainer.classList.toggle('interactive-response', isResponseVM(element));
542541
const progressMessageAtBottomOfResponse = checkModeOption(this.delegate.currentChatMode(), this.rendererOptions.progressMessageAtBottomOfResponse);
543-
templateData.rowContainer.classList.toggle('show-detail-progress', isResponseVM(element) && !element.isComplete && !element.progressMessages.length && !element.model.isPaused.get() && !progressMessageAtBottomOfResponse);
542+
templateData.rowContainer.classList.toggle('show-detail-progress', isResponseVM(element) && !element.isComplete && !element.progressMessages.length && !progressMessageAtBottomOfResponse);
544543
if (!this.rendererOptions.noHeader) {
545544
this.renderAvatar(element, templateData);
546545
}
@@ -643,11 +642,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
643642
}, $('span.agentOrSlashCommandDetected')));
644643

645644
} else if (this.rendererOptions.renderStyle !== 'minimal' && !element.isComplete && !checkModeOption(this.delegate.currentChatMode(), this.rendererOptions.progressMessageAtBottomOfResponse)) {
646-
if (element.model.isPaused.get()) {
647-
templateData.detail.textContent = localize('paused', "Paused");
648-
} else {
649-
templateData.detail.textContent = localize('working', "Working");
650-
}
645+
templateData.detail.textContent = localize('working', "Working");
651646
}
652647
}
653648

@@ -1038,10 +1033,6 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
10381033
element.renderData = { lastRenderTime: Date.now(), renderedWordCount: newRenderedWordCount, renderedParts: partsToRender };
10391034
}
10401035

1041-
if (this.shouldShowWorkingProgress(element, partsToRender)) {
1042-
const isPaused = element.model.isPaused.get();
1043-
partsToRender.push({ kind: 'working', isPaused, setPaused: p => element.model.setPaused(p) });
1044-
}
10451036
const fileChangesSummaryPart = this.getChatFileChangesSummaryPart(element);
10461037
if (fileChangesSummaryPart) {
10471038
partsToRender.push(fileChangesSummaryPart);
@@ -1054,30 +1045,6 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
10541045
return element.isComplete && this.configService.getValue<boolean>('chat.checkpoints.showFileChanges');
10551046
}
10561047

1057-
private shouldShowWorkingProgress(element: IChatResponseViewModel, partsToRender: IChatRendererContent[]): boolean {
1058-
if (element.agentOrSlashCommandDetected || this.rendererOptions.renderStyle === 'minimal' || element.isComplete || !checkModeOption(this.delegate.currentChatMode(), this.rendererOptions.progressMessageAtBottomOfResponse)) {
1059-
return false;
1060-
}
1061-
1062-
if (element.model.isPaused.get()) {
1063-
return true;
1064-
}
1065-
1066-
// Show if no content, only "used references", ends with a complete tool call, or ends with complete text edits and there is no incomplete tool call (edits are still being applied some time after they are all generated)
1067-
const lastPart = findLast(partsToRender, part => part.kind !== 'markdownContent' || part.content.value.trim().length > 0);
1068-
if (
1069-
!lastPart ||
1070-
lastPart.kind === 'references' ||
1071-
(lastPart.kind === 'toolInvocation' && (lastPart.isComplete || lastPart.presentation === 'hidden')) ||
1072-
((lastPart.kind === 'textEditGroup' || lastPart.kind === 'notebookEditGroup') && lastPart.done && !partsToRender.some(part => part.kind === 'toolInvocation' && !part.isComplete)) ||
1073-
(lastPart.kind === 'progressTask' && lastPart.deferred.isSettled) ||
1074-
lastPart.kind === 'prepareToolInvocation'
1075-
) {
1076-
return true;
1077-
}
1078-
1079-
return false;
1080-
}
10811048

10821049
private getDataForProgressiveRender(element: IChatResponseViewModel) {
10831050
const renderData = element.renderData ?? { lastRenderTime: 0, renderedWordCount: 0 };
@@ -1142,8 +1109,6 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
11421109
return this.renderExtensionsContent(content, context, templateData);
11431110
} else if (content.kind === 'pullRequest') {
11441111
return this.renderPullRequestContent(content, context, templateData);
1145-
} else if (content.kind === 'working') {
1146-
return this.renderWorkingProgress(content, context);
11471112
} else if (content.kind === 'undoStop') {
11481113
return this.renderUndoStop(content);
11491114
} else if (content.kind === 'errorDetails') {
@@ -1333,9 +1298,6 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
13331298
return taskPart;
13341299
}
13351300

1336-
private renderWorkingProgress(workingProgress: IChatWorkingProgress, context: IChatContentPartRenderContext): IChatContentPart | undefined {
1337-
return this.instantiationService.createInstance(ChatWorkingProgressContentPart, workingProgress, this.renderer, context);
1338-
}
13391301

13401302
private renderConfirmation(context: IChatContentPartRenderContext, confirmation: IChatConfirmation, templateData: IChatListItemTemplate): IChatContentPart {
13411303
const part = this.instantiationService.createInstance(ChatConfirmationContentPart, confirmation, context);

0 commit comments

Comments
 (0)