[go: nahoru, domu]

Skip to content

Commit

Permalink
Show notification when chat fails to load
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Feb 27, 2024
1 parent 41e6018 commit 71e7e97
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/vs/workbench/contrib/chat/common/chatServiceImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ILogService } from 'vs/platform/log/common/log';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { Progress } from 'vs/platform/progress/common/progress';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
Expand Down Expand Up @@ -167,7 +168,8 @@ export class ChatService extends Disposable implements IChatService {
@IWorkspaceContextService private readonly workspaceContextService: IWorkspaceContextService,
@IChatSlashCommandService private readonly chatSlashCommandService: IChatSlashCommandService,
@IChatVariablesService private readonly chatVariablesService: IChatVariablesService,
@IChatAgentService private readonly chatAgentService: IChatAgentService
@IChatAgentService private readonly chatAgentService: IChatAgentService,
@INotificationService private readonly notificationService: INotificationService,
) {
super();

Expand Down Expand Up @@ -396,9 +398,9 @@ export class ChatService extends Disposable implements IChatService {

const defaultAgent = this.chatAgentService.getDefaultAgent();
if (!defaultAgent) {
this.notificationService.error('Chat failed to load. Please ensure that the Copilot Chat extension is up to date');
throw new Error('No default agent');
}

const welcomeMessage = model.welcomeMessage ? undefined : await defaultAgent.provideWelcomeMessage?.(token) ?? undefined;
const welcomeModel = welcomeMessage && new ChatWelcomeMessageModel(
model,
Expand Down

0 comments on commit 71e7e97

Please sign in to comment.