From ef514575eb8c04ae8d5148c7afdf3a0dea0bac9d Mon Sep 17 00:00:00 2001 From: Jazzcort Date: Mon, 14 Apr 2025 11:45:02 -0400 Subject: [PATCH 1/3] Provide model name for tokens counting Although Continue now uses the Llama tokenizer for most models, it's still important to provide the model name to the countTokens function. This ensures flexibility in case we introduce more specialized tokenizers for different models in the future. --- core/core.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/core.ts b/core/core.ts index 68aa605ac2..c331e72730 100644 --- a/core/core.ts +++ b/core/core.ts @@ -709,7 +709,7 @@ export class Core { throw new Error("No chat model selected"); } - const tokens = countTokens(item.content); + const tokens = countTokens(item.content, llm.model); if (tokens > llm.contextLength - llm.completionOptions!.maxTokens!) { return true; From a53ce41d914a3b4e0a796711ddfbb05096ca5740 Mon Sep 17 00:00:00 2001 From: Jazzcort Date: Mon, 14 Apr 2025 11:58:13 -0400 Subject: [PATCH 2/3] Fix typo in error dialog Fixed typo from "connot" to "cannot" --- gui/src/components/mainInput/AtMentionDropdown/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/src/components/mainInput/AtMentionDropdown/index.tsx b/gui/src/components/mainInput/AtMentionDropdown/index.tsx index 9d5a10bec1..41df0112e6 100644 --- a/gui/src/components/mainInput/AtMentionDropdown/index.tsx +++ b/gui/src/components/mainInput/AtMentionDropdown/index.tsx @@ -251,7 +251,7 @@ const AtMentionDropdown = forwardRef((props: AtMentionDropdownProps, ref) => { modal: true, detail: fileSize > 0 - ? `'${item.title}' is ${formatFileSize(fileSize)} which exceeds the allowed context length and connot be processed by the model` + ? `'${item.title}' is ${formatFileSize(fileSize)} which exceeds the allowed context length and cannot be processed by the model` : `'${item.title}' could not be loaded. Please check if the file exists and has the correct permissions.`, }, ); From 73c0c206820ffc6465f75c84f2b3326a5675426b Mon Sep 17 00:00:00 2001 From: Jazzcort Date: Mon, 14 Apr 2025 12:03:49 -0400 Subject: [PATCH 3/3] Delete redundant calling of loadConfig Config has already been gathered at the top of this function, so we can directly use this config instead of calling loadConfig again. --- core/core.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/core.ts b/core/core.ts index c331e72730..bb11ac5edc 100644 --- a/core/core.ts +++ b/core/core.ts @@ -702,8 +702,7 @@ export class Core { return false; } - const llm = (await this.configHandler.loadConfig()).config - ?.selectedModelByRole.chat; + const llm = config?.selectedModelByRole.chat; if (!llm) { throw new Error("No chat model selected");