mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
Merge pull request #211395 from microsoft/roblou/revolutionary-leopon
Add error message for chat loading
This commit is contained in:
commit
2fb3fa8dd2
|
@ -3,6 +3,7 @@
|
||||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import { Action } from 'vs/base/common/actions';
|
||||||
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
import { CancellationToken, CancellationTokenSource } from 'vs/base/common/cancellation';
|
||||||
import { ErrorNoTelemetry } from 'vs/base/common/errors';
|
import { ErrorNoTelemetry } from 'vs/base/common/errors';
|
||||||
import { Emitter, Event } from 'vs/base/common/event';
|
import { Emitter, Event } from 'vs/base/common/event';
|
||||||
|
@ -13,9 +14,10 @@ import { revive } from 'vs/base/common/marshalling';
|
||||||
import { StopWatch } from 'vs/base/common/stopwatch';
|
import { StopWatch } from 'vs/base/common/stopwatch';
|
||||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
|
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||||
import { ILogService } from 'vs/platform/log/common/log';
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
|
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||||
import { Progress } from 'vs/platform/progress/common/progress';
|
import { Progress } from 'vs/platform/progress/common/progress';
|
||||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||||
|
@ -145,7 +147,9 @@ export class ChatService extends Disposable implements IChatService {
|
||||||
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
|
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
|
||||||
@IChatSlashCommandService private readonly chatSlashCommandService: IChatSlashCommandService,
|
@IChatSlashCommandService private readonly chatSlashCommandService: IChatSlashCommandService,
|
||||||
@IChatVariablesService private readonly chatVariablesService: IChatVariablesService,
|
@IChatVariablesService private readonly chatVariablesService: IChatVariablesService,
|
||||||
@IChatAgentService private readonly chatAgentService: IChatAgentService
|
@IChatAgentService private readonly chatAgentService: IChatAgentService,
|
||||||
|
@INotificationService private readonly notificationService: INotificationService,
|
||||||
|
@ICommandService private readonly commandService: ICommandService,
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -349,6 +353,17 @@ export class ChatService extends Disposable implements IChatService {
|
||||||
const defaultAgent = this.chatAgentService.getActivatedAgents().find(agent => agent.id === defaultAgentData.id);
|
const defaultAgent = this.chatAgentService.getActivatedAgents().find(agent => agent.id === defaultAgentData.id);
|
||||||
if (!defaultAgent) {
|
if (!defaultAgent) {
|
||||||
// Should have been registered during activation above!
|
// Should have been registered during activation above!
|
||||||
|
this.notificationService.notify({
|
||||||
|
severity: Severity.Error,
|
||||||
|
message: localize('chatFailErrorMessage', "Chat failed to load. Please ensure that the GitHub Copilot Chat extension is up to date."),
|
||||||
|
actions: {
|
||||||
|
primary: [
|
||||||
|
new Action('showExtension', localize('action.showExtension', "Show Extension"), undefined, true, () => {
|
||||||
|
return this.commandService.executeCommand('workbench.extensions.action.showExtensionsWithIds', ['GitHub.copilot-chat']);
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
throw new ErrorNoTelemetry('No default agent registered');
|
throw new ErrorNoTelemetry('No default agent registered');
|
||||||
}
|
}
|
||||||
const welcomeMessage = model.welcomeMessage ? undefined : await defaultAgent.provideWelcomeMessage?.(model.initialLocation, token) ?? undefined;
|
const welcomeMessage = model.welcomeMessage ? undefined : await defaultAgent.provideWelcomeMessage?.(model.initialLocation, token) ?? undefined;
|
||||||
|
|
|
@ -58,6 +58,8 @@ import { ChatWidgetHistoryService, IChatWidgetHistoryService } from 'vs/workbenc
|
||||||
import { IHoverService } from 'vs/platform/hover/browser/hover';
|
import { IHoverService } from 'vs/platform/hover/browser/hover';
|
||||||
import { NullHoverService } from 'vs/platform/hover/test/browser/nullHoverService';
|
import { NullHoverService } from 'vs/platform/hover/test/browser/nullHoverService';
|
||||||
import { ChatVariablesService } from 'vs/workbench/contrib/chat/browser/chatVariables';
|
import { ChatVariablesService } from 'vs/workbench/contrib/chat/browser/chatVariables';
|
||||||
|
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
|
import { TestCommandService } from 'vs/editor/test/browser/editorTestServices';
|
||||||
|
|
||||||
suite('InteractiveChatController', function () {
|
suite('InteractiveChatController', function () {
|
||||||
class TestController extends InlineChatController {
|
class TestController extends InlineChatController {
|
||||||
|
@ -136,6 +138,7 @@ suite('InteractiveChatController', function () {
|
||||||
[IInlineChatService, new SyncDescriptor(InlineChatServiceImpl)],
|
[IInlineChatService, new SyncDescriptor(InlineChatServiceImpl)],
|
||||||
[IDiffProviderFactoryService, new SyncDescriptor(TestDiffProviderFactoryService)],
|
[IDiffProviderFactoryService, new SyncDescriptor(TestDiffProviderFactoryService)],
|
||||||
[IInlineChatSessionService, new SyncDescriptor(InlineChatSessionServiceImpl)],
|
[IInlineChatSessionService, new SyncDescriptor(InlineChatSessionServiceImpl)],
|
||||||
|
[ICommandService, new SyncDescriptor(TestCommandService)],
|
||||||
[IInlineChatSavingService, new class extends mock<IInlineChatSavingService>() {
|
[IInlineChatSavingService, new class extends mock<IInlineChatSavingService>() {
|
||||||
override markChanged(session: Session): void {
|
override markChanged(session: Session): void {
|
||||||
// noop
|
// noop
|
||||||
|
|
|
@ -55,6 +55,8 @@ import { IViewsService } from 'vs/workbench/services/views/common/viewsService';
|
||||||
import { TestExtensionService, TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
|
import { TestExtensionService, TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||||
import { IChatAgentService, ChatAgentService, ChatAgentLocation } from 'vs/workbench/contrib/chat/common/chatAgents';
|
import { IChatAgentService, ChatAgentService, ChatAgentLocation } from 'vs/workbench/contrib/chat/common/chatAgents';
|
||||||
import { ChatVariablesService } from 'vs/workbench/contrib/chat/browser/chatVariables';
|
import { ChatVariablesService } from 'vs/workbench/contrib/chat/browser/chatVariables';
|
||||||
|
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||||
|
import { TestCommandService } from 'vs/editor/test/browser/editorTestServices';
|
||||||
|
|
||||||
suite('InlineChatSession', function () {
|
suite('InlineChatSession', function () {
|
||||||
|
|
||||||
|
@ -89,6 +91,7 @@ suite('InlineChatSession', function () {
|
||||||
[IContextKeyService, contextKeyService],
|
[IContextKeyService, contextKeyService],
|
||||||
[IDiffProviderFactoryService, new SyncDescriptor(TestDiffProviderFactoryService)],
|
[IDiffProviderFactoryService, new SyncDescriptor(TestDiffProviderFactoryService)],
|
||||||
[IInlineChatSessionService, new SyncDescriptor(InlineChatSessionServiceImpl)],
|
[IInlineChatSessionService, new SyncDescriptor(InlineChatSessionServiceImpl)],
|
||||||
|
[ICommandService, new SyncDescriptor(TestCommandService)],
|
||||||
[IInlineChatSavingService, new class extends mock<IInlineChatSavingService>() {
|
[IInlineChatSavingService, new class extends mock<IInlineChatSavingService>() {
|
||||||
override markChanged(session: Session): void {
|
override markChanged(session: Session): void {
|
||||||
// noop
|
// noop
|
||||||
|
|
Loading…
Reference in a new issue