Skip to content

Commit 725c7c2

Browse files
authored
Assistant: direct user to sign into anthropic when no chat providers available (#8302)
### Summary - addresses #8256 - stop gap in place of #8292 which may be revived in #8301 https://github.com/user-attachments/assets/f769c080-0b92-48ad-be00-62ce7ab3bf08 ### Release Notes #### Bug Fixes - Assistant: guidance to sign into Anthropic when no Chat providers are registered (#8256) ### QA Notes @:assistant When the user has no Chat providers (not signed into any providers or only signed into Copilot), the user should see: - the "Set Up Positron Assistant" welcome page with Anthropic-specific guidance - an error message directing the user to sign in with Anthropic if input is submitted in the chat
1 parent 6b3c3e2 commit 725c7c2

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,13 @@ export class ExtHostChatAgents2 extends Disposable implements ExtHostChatAgentsS
451451
if (!model) {
452452
model = await this._languageModels.getDefaultLanguageModel(extension);
453453
if (!model) {
454+
// --- Start Positron ---
455+
// TODO: make this more generic once we support more model providers https://github.com/posit-dev/positron/issues/8301
456+
throw new Error('No language models available for chat. Please ensure you have logged into Anthropic as a language model provider by clicking `Add Model Provider...` or running the command `Positron Assistant: Configure Language Model Providers` and authenticating with Anthropic.');
457+
/*
454458
throw new Error('Language model unavailable');
459+
*/
460+
// --- End Positron ---
455461
}
456462
}
457463

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,12 +741,20 @@ export class ChatWidget extends Disposable implements IChatWidget {
741741
if (!this.configurationService.getValue('positron.assistant.enable')) {
742742
welcomeTitle = localize('positronAssistant.comingSoonTitle', "Coming Soon");
743743
welcomeText = localize('positronAssistant.comingSoonMessage', "Positron Assistant is under development and will be available in a future version of Positron.\n");
744-
} else if (this.languageModelsService.getLanguageModelIds().length === 0) {
744+
} else if (!this.languageModelsService.currentProvider) {
745+
// When Anthropic is the only supported provider, we can use a more specific message.
746+
// TODO: remove this custom handling https://github.com/posit-dev/positron/issues/8301
747+
const hasAdditionalModels = this.configurationService.getValue<boolean>('positron.assistant.testModels') ||
748+
this.configurationService.getValue<string[]>('positron.assistant.enabledProviders')?.length > 0;
749+
745750
welcomeTitle = localize('positronAssistant.gettingStartedTitle', "Set Up Positron Assistant");
746-
const addLanguageModelMessage = localize('positronAssistant.addLanguageModelMessage', "Add Language Model Provider");
751+
const addLanguageModelMessage = hasAdditionalModels
752+
? localize('positronAssistant.addLanguageModelMessage', "Add Language Model Provider")
753+
: localize('positronAssistant.addLanguageModelMessageAnthropic', "Add Anthropic as a Chat Provider");
747754
firstLinkToButton = true;
748-
// create a multi-line message
749-
welcomeText = localize('positronAssistant.welcomeMessage', "To use Positron Assistant you must first select and authenticate with a language model provider.\n");
755+
welcomeText = hasAdditionalModels
756+
? localize('positronAssistant.welcomeMessage', "To use Positron Assistant you must first select and authenticate with a language model provider.\n")
757+
: localize('positronAssistant.welcomeMessageAnthropic', "To use Positron Assistant Chat, you must first authenticate with Anthropic.\n");
750758
welcomeText += `\n\n[${addLanguageModelMessage}](command:positron-assistant.configureModels)`;
751759
} else {
752760
const guideLinkMessage = localize('positronAssistant.guideLinkMessage', "Positron Assistant User Guide");

0 commit comments

Comments
 (0)