From 198529aa9bef4d6aa39ac631779f5fd6b0c4b87c Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 25 Feb 2025 08:57:08 -0800 Subject: [PATCH] Give message to user instead of sending request if Anthropic API key not set --- core/llm/llms/Anthropic.ts | 6 ++++++ extensions/vscode/package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/llm/llms/Anthropic.ts b/core/llm/llms/Anthropic.ts index df527d579..dcd13d38e 100644 --- a/core/llm/llms/Anthropic.ts +++ b/core/llm/llms/Anthropic.ts @@ -145,6 +145,12 @@ class Anthropic extends BaseLLM { signal: AbortSignal, options: CompletionOptions, ): AsyncGenerator { + if (!this.apiKey || this.apiKey === "") { + throw new Error( + "Request not sent. You have an Anthropic model configured in your config.json, but the API key is not set.", + ); + } + const shouldCacheSystemMessage = !!this.systemMessage && this.cacheBehavior?.cacheSystemMessage; const systemMessage: string = stripImages( diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index f47393c21..4c87ea033 100644 --- a/extensions/vscode/package.json +++ b/extensions/vscode/package.json @@ -2,7 +2,7 @@ "name": "continue", "icon": "media/icon.png", "author": "Continue Dev, Inc", - "version": "0.9.271", + "version": "0.9.272", "repository": { "type": "git", "url": "https://github.com/continuedev/continue"