diff --git a/core/config/ConfigHandler.ts b/core/config/ConfigHandler.ts index cdfe1d451..3b5c4c0df 100644 --- a/core/config/ConfigHandler.ts +++ b/core/config/ConfigHandler.ts @@ -9,6 +9,7 @@ import { ILLMLogger, } from "../index.js"; import { GlobalContext } from "../util/GlobalContext.js"; +import { getConfigYamlPath } from "../util/paths.js"; import EventEmitter from "node:events"; import { Logger } from "../util/Logger.js"; @@ -346,6 +347,7 @@ export class ConfigHandler { return; } + getConfigYamlPath(); const configFile = element?.sourceFile ?? profile.profileDescription.uri; await this.ide.openFile(configFile); } diff --git a/core/llm/llms/Ollama.ts b/core/llm/llms/Ollama.ts index c9142206a..4bcd9fb1e 100644 --- a/core/llm/llms/Ollama.ts +++ b/core/llm/llms/Ollama.ts @@ -161,7 +161,7 @@ class Ollama extends BaseLLM implements ModelInstaller { private static modelsBeingInstalledMutex = new Mutex(); private fimSupported: boolean = false; - private templateSupportsTools: boolean | undefined = undefined; + private modelInfoPromise: Promise | undefined = undefined; private explicitContextLength: boolean; @@ -240,11 +240,6 @@ class Ollama extends BaseLLM implements ModelInstaller { * it's a good indication the model supports FIM. */ this.fimSupported = !!body?.template?.includes(".Suffix"); - - // Check if model template supports tool calling (same pattern as .Suffix above) - if (body?.template) { - this.templateSupportsTools = body.template.includes(".Tools"); - } }) .catch((e) => { // console.warn("Error calling the Ollama /api/show endpoint: ", e); @@ -516,12 +511,7 @@ class Ollama extends BaseLLM implements ModelInstaller { stream: options.stream, // format: options.format, // Not currently in base completion options }; - // Only include tools with user messages, and only if the template supports them - if ( - options.tools?.length && - ollamaMessages.at(-1)?.role === "user" && - this.templateSupportsTools !== false - ) { + if (options.tools?.length && ollamaMessages.at(-1)?.role === "user") { chatOptions.tools = options.tools.map((tool) => ({ type: "function", function: { diff --git a/core/util/paths.ts b/core/util/paths.ts index 122ec2f94..323697f77 100644 --- a/core/util/paths.ts +++ b/core/util/paths.ts @@ -118,15 +118,12 @@ export function getConfigJsonPath(): string { export function getConfigYamlPath(ideType?: IdeType): string { const p = path.join(getContinueGlobalPath(), "config.yaml"); - if (!fs.existsSync(p) && !fs.existsSync(getConfigJsonPath())) { - if (ideType === "jetbrains") { - // https://github.com/continuedev/continue/pull/7224 - // This was here because we had different context provider support between jetbrains and vs code - // Leaving so we could differentiate later but for now configs are the same between IDEs - fs.writeFileSync(p, YAML.stringify(defaultConfig)); - } else { - fs.writeFileSync(p, YAML.stringify(defaultConfig)); - } + const exists = fs.existsSync(p); + const isEmpty = exists && fs.readFileSync(p, "utf8").trim() === ""; + const needsCreation = !exists && !fs.existsSync(getConfigJsonPath()); + + if (needsCreation || isEmpty) { + fs.writeFileSync(p, YAML.stringify(defaultConfig)); setConfigFilePermissions(p); } return p; diff --git a/extensions/intellij/gradle.properties b/extensions/intellij/gradle.properties index 1bd3f3c9f..a3ff59b25 100644 --- a/extensions/intellij/gradle.properties +++ b/extensions/intellij/gradle.properties @@ -1,5 +1,5 @@ pluginGroup=com.github.continuedev.continueintellijextension -pluginVersion=1.0.65 +pluginVersion=1.0.67 platformVersion=2024.1 kotlin.stdlib.default.dependency=false org.gradle.configuration-cache=true diff --git a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/UriUtils.kt b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/UriUtils.kt index ca5d0e21b..d2030280f 100644 --- a/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/UriUtils.kt +++ b/extensions/intellij/src/main/kotlin/com/github/continuedev/continueintellijextension/continue/UriUtils.kt @@ -26,7 +26,7 @@ object UriUtils { // Handle Windows file paths with authority component if (uriStr.startsWith("file://") && !uriStr.startsWith("file:///")) { val path = uriStr.substringAfter("file://") - return URI("file:///$path") + return URI("file", "", "/$path", null) } return try { diff --git a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/UriUtilsTest.kt b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/UriUtilsTest.kt index a718f722b..8295abfe6 100644 --- a/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/UriUtilsTest.kt +++ b/extensions/intellij/src/test/kotlin/com/github/continuedev/continueintellijextension/unit/UriUtilsTest.kt @@ -60,4 +60,19 @@ class UriUtilsTest : TestCase() { val expectedFile = File("/path/to/file with spaces") assertEquals(expectedFile, result) } + + // Regression test for #10978 — bracket directories like [gamemode] + fun `test square brackets in path`() { + val uri = "file:///path/to/[gamemode]/file.lua" + val result = UriUtils.uriToFile(uri) + assertEquals(File("/path/to/[gamemode]/file.lua"), result) + } + + fun `test Windows path with square brackets`() { + val uri = "file://C:/Users/user/projects/[gamemode]/file.lua" + val parsed = UriUtils.parseUri(uri) + assertEquals("file", parsed.scheme) + assertEquals("/C:/Users/user/projects/[gamemode]/file.lua", parsed.path) + assertEquals("file:///C:/Users/user/projects/%5Bgamemode%5D/file.lua", parsed.toString()) + } } diff --git a/extensions/vscode/package.json b/extensions/vscode/package.json index d24a267b6..54bfbb763 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.3.36", + "version": "1.3.38", "repository": { "type": "git", "url": "https://github.com/continuedev/continue"