From fa295177585fde9aea76df201ccb7c3792e0d5ca Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 17 Jun 2025 13:11:20 -0700 Subject: [PATCH 1/4] respect embeddings batching for bedrock, hugginface, sagemaker --- core/llm/llms/Bedrock.ts | 2 +- core/llm/llms/HuggingFaceTEI.ts | 11 +---------- core/llm/llms/SageMaker.ts | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/core/llm/llms/Bedrock.ts b/core/llm/llms/Bedrock.ts index ae595f3f3..3fc229465 100644 --- a/core/llm/llms/Bedrock.ts +++ b/core/llm/llms/Bedrock.ts @@ -547,7 +547,7 @@ class Bedrock extends BaseLLM { } // EMBED // - async embed(chunks: string[]): Promise { + async _embed(chunks: string[]): Promise { const credentials = await this._getCredentials(); const client = new BedrockRuntimeClient({ region: this.region, diff --git a/core/llm/llms/HuggingFaceTEI.ts b/core/llm/llms/HuggingFaceTEI.ts index 175aedde0..fcf20ac8e 100644 --- a/core/llm/llms/HuggingFaceTEI.ts +++ b/core/llm/llms/HuggingFaceTEI.ts @@ -25,16 +25,7 @@ class HuggingFaceTEIEmbeddingsProvider extends BaseLLM { }); } - async embed(chunks: string[]) { - const batchedChunks = this.getBatchedChunks(chunks); - - const results = await Promise.all( - batchedChunks.map((batch) => this.doEmbedRequest(batch)), - ); - return results.flat(); - } - - async doEmbedRequest(batch: string[]): Promise { + async _embed(batch: string[]): Promise { const headers: Record = { "Content-Type": "application/json", }; diff --git a/core/llm/llms/SageMaker.ts b/core/llm/llms/SageMaker.ts index bbb87c131..1d1a950c9 100644 --- a/core/llm/llms/SageMaker.ts +++ b/core/llm/llms/SageMaker.ts @@ -141,7 +141,7 @@ class SageMaker extends BaseLLM { } } - async embed(chunks: string[]) { + async _embed(chunks: string[]) { const credentials = await this._getCredentials(); const client = new SageMakerRuntimeClient({ region: this.region, From 69ea88ccc5ea18cd81443a1b8ad81f26809fc562 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Tue, 17 Jun 2025 15:52:17 -0700 Subject: [PATCH 2/4] reduce codebase indexer file batch size --- core/indexing/CodebaseIndexer.test.ts | 10 +--------- core/indexing/CodebaseIndexer.ts | 14 +++++--------- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/core/indexing/CodebaseIndexer.test.ts b/core/indexing/CodebaseIndexer.test.ts index b697520aa..f2a31209c 100644 --- a/core/indexing/CodebaseIndexer.test.ts +++ b/core/indexing/CodebaseIndexer.test.ts @@ -124,14 +124,6 @@ describe("CodebaseIndexer", () => { return updates; } - async function refreshIndexFiles(files: string[]) { - const updates = []; - for await (const update of codebaseIndexer.refreshFiles(files)) { - updates.push(update); - } - return updates; - } - async function getAllIndexedFiles() { const files = await testIndex.getIndexedFilesForTags( await testIde.getTags(testIndex.artifactId), @@ -197,7 +189,7 @@ describe("CodebaseIndexer", () => { test("should successfuly re-index specific files", async () => { // Could add more specific tests for this but uses similar logic const before = await getAllIndexedFiles(); - await refreshIndexFiles(before); + await codebaseIndexer.refreshCodebaseIndexFiles(before); const after = await getAllIndexedFiles(); expect(after.length).toBe(before.length); diff --git a/core/indexing/CodebaseIndexer.ts b/core/indexing/CodebaseIndexer.ts index 86933f8bd..d2de0c512 100644 --- a/core/indexing/CodebaseIndexer.ts +++ b/core/indexing/CodebaseIndexer.ts @@ -43,7 +43,7 @@ export class CodebaseIndexer { * - To limit memory usage for indexes that perform computations locally, e.g. FTS * - To make as few requests as possible to the embeddings providers */ - filesPerBatch = 500; + filesPerBatch = 200; private indexingCancellationController: AbortController | undefined; private codebaseIndexingState: IndexingProgressUpdate; private readonly pauseToken: PauseToken; @@ -75,16 +75,10 @@ export class CodebaseIndexer { this.pauseToken = new PauseToken(initialPaused); } - /** - * Set the paused state of the indexer - */ set paused(value: boolean) { this.pauseToken.paused = value; } - /** - * Get the current paused state of the indexer - */ get paused(): boolean { return this.pauseToken.paused; } @@ -235,7 +229,9 @@ export class CodebaseIndexer { } } - async *refreshFiles(files: string[]): AsyncGenerator { + private async *refreshFiles( + files: string[], + ): AsyncGenerator { let progress = 0; if (files.length === 0) { yield { @@ -525,7 +521,7 @@ export class CodebaseIndexer { repoName, )) { yield { - progress: progress, + progress, desc, status: "indexing", }; From 0606bfa96f6e02f724901a27a1b3c2e7b74af0f6 Mon Sep 17 00:00:00 2001 From: Tomasz Stefaniak Date: Tue, 24 Jun 2025 16:54:26 -0700 Subject: [PATCH 3/4] chore: prerelease --- extensions/vscode/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index 22c040f40..01253be49 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": "1.1.50", + "version": "1.1.51", "repository": { "type": "git", "url": "https://github.com/continuedev/continue" From 3831a0b7f6ed75def117884316fd2c5f93170778 Mon Sep 17 00:00:00 2001 From: Jakub Blach Date: Wed, 25 Jun 2025 15:54:20 +0200 Subject: [PATCH 4/4] fix: Replace Desktop util with built-in BrowserUtil (fixes #6020) --- .../auth/ContinueAuthService.kt | 4 +- .../continue/IntelliJIde.kt | 3 +- .../utils/Desktop.kt | 214 ------------------ 3 files changed, 4 insertions(+), 217 deletions(-) delete mode 100644 extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Desktop.kt diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt index 28f81b319..13ceaf810 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/auth/ContinueAuthService.kt @@ -2,9 +2,9 @@ package com.github.continuedev.continueintellijextension.auth import com.github.continuedev.continueintellijextension.services.ContinueExtensionSettings import com.github.continuedev.continueintellijextension.services.ContinuePluginService -import com.github.continuedev.continueintellijextension.utils.Desktop import com.google.gson.Gson import com.intellij.credentialStore.Credentials +import com.intellij.ide.BrowserUtil import com.intellij.ide.passwordSafe.PasswordSafe import com.intellij.ide.util.PropertiesComponent import com.intellij.openapi.application.ApplicationManager @@ -165,7 +165,7 @@ class ContinueAuthService { // Still open the URL in the browser (keeping existing behavior) if (authUrl != null) { - Desktop.browse(java.net.URI(authUrl)) + BrowserUtil.open(authUrl!!) } return authUrl diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt index a692759b9..ce374d4e9 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/IntelliJIde.kt @@ -10,6 +10,7 @@ import com.github.continuedev.continueintellijextension.utils.* import com.intellij.codeInsight.daemon.impl.HighlightInfo import com.intellij.execution.configurations.GeneralCommandLine import com.intellij.execution.util.ExecUtil +import com.intellij.ide.BrowserUtil import com.intellij.ide.plugins.PluginManager import com.intellij.ide.plugins.PluginManagerCore import com.intellij.lang.annotation.HighlightSeverity @@ -211,7 +212,7 @@ class IntelliJIDE( override suspend fun openUrl(url: String) { withContext(Dispatchers.IO) { - Desktop.browse(URI(url)) + BrowserUtil.browse(url) } } diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Desktop.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Desktop.kt deleted file mode 100644 index 8dd20536c..000000000 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/utils/Desktop.kt +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright © 2017 jjYBdx4IL (https://github.com/jjYBdx4IL) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.github.continuedev.continueintellijextension.utils - -import org.apache.commons.lang3.SystemUtils -import org.slf4j.LoggerFactory -import java.io.File -import java.io.IOException -import java.net.URI - -object Desktop { - private val LOG = LoggerFactory.getLogger(Desktop::class.java) - - fun browse(uri: URI): Boolean { - if (browseDESKTOP(uri)) { - return true - } - - if (openSystemSpecific(uri.toString())) { - return true - } - - LOG.warn("failed to browse {}", uri) - return false - } - - fun open(file: File): Boolean { - if (openDESKTOP(file)) { - return true - } - - if (openSystemSpecific(file.path)) { - return true - } - - LOG.warn("failed to open {}", file.absolutePath) - return false - } - - fun edit(file: File): Boolean { - if (editDESKTOP(file)) { - return true - } - - if (openSystemSpecific(file.path)) { - return true - } - - LOG.warn("failed to edit {}", file.absolutePath) - return false - } - - private fun openSystemSpecific(what: String): Boolean { - if (SystemUtils.IS_OS_LINUX) { - if (isXDG() && runCommand("xdg-open", "%s", what)) { - return true - } - if (isKDE() && runCommand("kde-open", "%s", what)) { - return true - } - if (isGNOME() && runCommand("gnome-open", "%s", what)) { - return true - } - if (runCommand("kde-open", "%s", what)) { - return true - } - if (runCommand("gnome-open", "%s", what)) { - return true - } - } - - if (SystemUtils.IS_OS_MAC && runCommand("open", "%s", what)) { - return true - } - - if (SystemUtils.IS_OS_WINDOWS && runCommand("explorer", "%s", what)) { - return true - } - - return false - } - - private fun browseDESKTOP(uri: URI): Boolean { - return try { - if (!java.awt.Desktop.isDesktopSupported()) { - LOG.debug("Platform is not supported.") - return false - } - - if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.BROWSE)) { - LOG.debug("BROWSE is not supported.") - return false - } - - LOG.info("Trying to use Desktop.getDesktop().browse() with {}", uri.toString()) - java.awt.Desktop.getDesktop().browse(uri) - true - } catch (t: Throwable) { - LOG.error("Error using desktop browse.", t) - false - } - } - - private fun openDESKTOP(file: File): Boolean { - return try { - if (!java.awt.Desktop.isDesktopSupported()) { - LOG.debug("Platform is not supported.") - return false - } - - if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.OPEN)) { - LOG.debug("OPEN is not supported.") - return false - } - - LOG.info("Trying to use Desktop.getDesktop().open() with {}", file.toString()) - java.awt.Desktop.getDesktop().open(file) - true - } catch (t: Throwable) { - LOG.error("Error using desktop open.", t) - false - } - } - - private fun editDESKTOP(file: File): Boolean { - return try { - if (!java.awt.Desktop.isDesktopSupported()) { - LOG.debug("Platform is not supported.") - return false - } - - if (!java.awt.Desktop.getDesktop().isSupported(java.awt.Desktop.Action.EDIT)) { - LOG.debug("EDIT is not supported.") - return false - } - - LOG.info("Trying to use Desktop.getDesktop().edit() with {}", file) - java.awt.Desktop.getDesktop().edit(file) - true - } catch (t: Throwable) { - LOG.error("Error using desktop edit.", t) - false - } - } - - private fun runCommand(command: String, args: String, file: String): Boolean { - LOG.info("Trying to exec:\n cmd = {}\n args = {}\n %s = {}", command, args, file) - - val parts = prepareCommand(command, args, file) - - return try { - val p = Runtime.getRuntime().exec(parts) - if (p == null) { - false - } else { - try { - val retval = p.exitValue() - if (retval == 0) { - LOG.error("Process ended immediately.") - false - } else { - LOG.error("Process crashed.") - false - } - } catch (itse: IllegalThreadStateException) { - LOG.error("Process is running.") - true - } - } - } catch (e: IOException) { - LOG.error("Error running command.", e) - false - } - } - - private fun prepareCommand(command: String, args: String?, file: String): Array { - val parts = mutableListOf() - parts.add(command) - - args?.split(" ")?.forEach { s -> - parts.add(String.format(s, file).trim()) - } - - return parts.toTypedArray() - } - - private fun isXDG(): Boolean { - val xdgSessionId = System.getenv("XDG_SESSION_ID") - return !xdgSessionId.isNullOrEmpty() - } - - private fun isGNOME(): Boolean { - val gdmSession = System.getenv("GDMSESSION") - return gdmSession?.lowercase()?.contains("gnome") == true - } - - private fun isKDE(): Boolean { - val gdmSession = System.getenv("GDMSESSION") - return gdmSession?.lowercase()?.contains("kde") == true - } -} \ No newline at end of file