-
Notifications
You must be signed in to change notification settings - Fork 36.4k
Add notification when closing chat session in progress #278993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import * as nls from '../../../../../nls.js'; | ||
| import { ServicesAccessor } from '../../../../../platform/instantiation/common/instantiation.js'; | ||
| import { INotificationService, NeverShowAgainScope, Severity } from '../../../../../platform/notification/common/notification.js'; | ||
| import { IViewsService } from '../../../../services/views/common/viewsService.js'; | ||
| import { AGENT_SESSIONS_VIEW_ID } from './agentSessions.js'; | ||
|
|
||
| const STORAGE_KEY = 'chat.closeWithActiveResponse.doNotShowAgain2'; | ||
|
|
||
| /** | ||
| * Shows a notification when closing a chat with an active response, informing the user | ||
| * that the chat will continue running in the background. The notification includes a button | ||
| * to open the Agent Sessions view and a "Don't Show Again" option. | ||
| */ | ||
| export function showCloseActiveChatNotification( | ||
| accessor: ServicesAccessor | ||
| ): void { | ||
| const notificationService = accessor.get(INotificationService); | ||
| const viewsService = accessor.get(IViewsService); | ||
|
|
||
| notificationService.prompt( | ||
| Severity.Info, | ||
| nls.localize('chat.closeWithActiveResponse', "A chat session is in progress. It will continue running in the background."), | ||
| [ | ||
| { | ||
| label: nls.localize('chat.openAgentSessions', "Open Agent Sessions"), | ||
| run: async () => { | ||
| await viewsService.openView(AGENT_SESSIONS_VIEW_ID, true); | ||
| } | ||
| } | ||
| ], | ||
| { | ||
| neverShowAgain: { | ||
| id: STORAGE_KEY, | ||
| scope: NeverShowAgainScope.APPLICATION | ||
| } | ||
| } | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -36,6 +36,7 @@ import { IChatModelReference, IChatService } from '../common/chatService.js'; | |||||||||
| import { IChatSessionsExtensionPoint, IChatSessionsService, localChatSessionType } from '../common/chatSessionsService.js'; | ||||||||||
| import { LocalChatSessionUri } from '../common/chatUri.js'; | ||||||||||
| import { ChatAgentLocation, ChatModeKind } from '../common/constants.js'; | ||||||||||
| import { showCloseActiveChatNotification } from './agentSessions/chatCloseNotification.js'; | ||||||||||
| import { ChatWidget } from './chatWidget.js'; | ||||||||||
| import { ChatViewWelcomeController, IViewWelcomeDelegate } from './viewsWelcome/chatViewWelcomeController.js'; | ||||||||||
|
|
||||||||||
|
|
@@ -148,6 +149,11 @@ export class ChatViewPane extends ViewPane implements IViewWelcomeDelegate { | |||||||||
| } | ||||||||||
|
|
||||||||||
| private async updateModel(modelRef?: IChatModelReference | undefined) { | ||||||||||
| // Check if we're disposing a model with an active request | ||||||||||
| if (this.modelRef.value?.object.requestInProgress.get()) { | ||||||||||
|
Comment on lines
+152
to
+153
|
||||||||||
| // Check if we're disposing a model with an active request | |
| if (this.modelRef.value?.object.requestInProgress.get()) { | |
| // Only show the notification if we're disposing a model with an active request and not replacing it | |
| if (!modelRef && this.modelRef.value?.object.requestInProgress.get()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to wait here or can fire & forget?