Skip to content

Commit f0fff46

Browse files
Merge branch 'main' into pe/remove-pre-indexed-docs-ui
2 parents 70e443e + 1255b21 commit f0fff46

File tree

9 files changed

+121
-145
lines changed

9 files changed

+121
-145
lines changed

core/config/load.ts

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -539,18 +539,21 @@ async function intermediateToFinalConfig(
539539
// Apply MCP if specified
540540
const mcpManager = MCPManagerSingleton.getInstance();
541541
if (config.experimental?.modelContextProtocolServers) {
542-
await Promise.all(
542+
const abortController = new AbortController();
543+
const mcpConnectionTimeout = setTimeout(
544+
() => abortController.abort(),
545+
4000,
546+
);
547+
548+
await Promise.allSettled(
543549
config.experimental.modelContextProtocolServers?.map(
544550
async (server, index) => {
545-
const mcpId = index.toString();
546-
const mcpConnection = mcpManager.createConnection(mcpId, server);
547-
if (!mcpConnection) {
548-
return;
549-
}
550-
551-
const abortController = new AbortController();
552-
553551
try {
552+
const mcpId = index.toString();
553+
const mcpConnection = mcpManager.createConnection(mcpId, server);
554+
if (!mcpConnection) {
555+
return;
556+
}
554557
const mcpError = await mcpConnection.modifyConfig(
555558
continueConfig,
556559
mcpId,
@@ -561,14 +564,21 @@ async function intermediateToFinalConfig(
561564
if (mcpError) {
562565
errors.push(mcpError);
563566
}
564-
} catch (e: any) {
567+
} catch (e) {
568+
let errorMessage = "Failed to load MCP server";
569+
if (e instanceof Error) {
570+
if (e.name === "AbortError") {
571+
errorMessage += ": connection timed out";
572+
} else {
573+
errorMessage += ": " + e.message;
574+
}
575+
}
565576
errors.push({
566577
fatal: false,
567-
message: `Failed to load MCP server: ${e.message}`,
578+
message: errorMessage,
568579
});
569-
if (e.name !== "AbortError") {
570-
throw e;
571-
}
580+
} finally {
581+
clearTimeout(mcpConnectionTimeout);
572582
}
573583
},
574584
) || [],

core/config/yaml/loadYaml.ts

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -331,27 +331,27 @@ async function configYamlToContinueConfig(
331331

332332
// Apply MCP if specified
333333
const mcpManager = MCPManagerSingleton.getInstance();
334-
await Promise.all(
334+
await Promise.allSettled(
335335
config.mcpServers?.map(async (server) => {
336-
const mcpId = server.name;
337-
const mcpConnection = mcpManager.createConnection(mcpId, {
338-
transport: {
339-
type: "stdio",
340-
args: [],
341-
...server,
342-
},
343-
});
344-
if (!mcpConnection) {
345-
return;
346-
}
347-
348336
const abortController = new AbortController();
349337
const mcpConnectionTimeout = setTimeout(
350338
() => abortController.abort(),
351-
5000,
339+
4000,
352340
);
353341

354342
try {
343+
const mcpId = server.name;
344+
const mcpConnection = mcpManager.createConnection(mcpId, {
345+
transport: {
346+
type: "stdio",
347+
args: [],
348+
...server,
349+
},
350+
});
351+
if (!mcpConnection) {
352+
return;
353+
}
354+
355355
const mcpError = await mcpConnection.modifyConfig(
356356
continueConfig,
357357
mcpId,
@@ -362,16 +362,22 @@ async function configYamlToContinueConfig(
362362
if (mcpError) {
363363
errors.push(mcpError);
364364
}
365-
} catch (e: any) {
365+
} catch (e) {
366+
let errorMessage = `Failed to load MCP server ${server.name}`;
367+
if (e instanceof Error) {
368+
if (e.name === "AbortError") {
369+
errorMessage += ": connection timed out";
370+
} else {
371+
errorMessage += ": " + e.message;
372+
}
373+
}
366374
errors.push({
367375
fatal: false,
368-
message: `Failed to load MCP server: ${e.message}`,
376+
message: errorMessage,
369377
});
370-
if (e.name !== "AbortError") {
371-
throw e;
372-
}
378+
} finally {
379+
clearTimeout(mcpConnectionTimeout);
373380
}
374-
clearTimeout(mcpConnectionTimeout);
375381
}) ?? [],
376382
);
377383

core/llm/constructMessages.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ import { normalizeToMessageParts } from "../util/messageContent";
88

99
import { modelSupportsTools } from "./autodetect";
1010

11-
const TOOL_USE_RULES = `When using tools, follow the following guidelines:
12-
- Avoid calling tools unless they are absolutely necessary. For example, if you are asked a simple programming question you do not need web search. As another example, if the user asks you to explain something about code, do not create a new file.`;
11+
const TOOL_USE_RULES = `<tool_use_rules>
12+
When using tools, follow the following guidelines:
13+
- Avoid calling tools unless they are absolutely necessary. For example, if you are asked a simple programming question you do not need web search. As another example, if the user asks you to explain something about code, do not create a new file.
14+
</tool_use_rules>`;
1315

1416
function constructSystemPrompt(
1517
modelDescription: ModelDescription,
1618
useTools: boolean,
1719
): string | null {
18-
let systemMessage =
19-
"Always include the language and file name in the info string when you write code blocks, for example '```python file.py'.";
20+
let systemMessage = `<important_rules>
21+
Always include the language and file name in the info string when you write code blocks. If you are editing "src/main.py" for example, your code block should start with '\`\`\`python src/main.py'.
22+
</important_rules>`;
2023
if (useTools && modelSupportsTools(modelDescription)) {
2124
systemMessage += "\n\n" + TOOL_USE_RULES;
2225
}

core/llm/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ export abstract class BaseLLM implements ILLM {
821821
for await (const chunk of stream) {
822822
const result = fromChatCompletionChunk(chunk);
823823
if (result) {
824+
completion += result.content;
824825
yield result;
825826
}
826827
if (!citations && (chunk as any).citations && Array.isArray((chunk as any).citations)) {

extensions/intellij/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pluginGroup=com.github.continuedev.continueintellijextension
33
pluginName=continue-intellij-extension
44
pluginRepositoryUrl=https://github.com/continuedev/continue
55
# SemVer format -> https://semver.org
6-
pluginVersion=1.0.2
6+
pluginVersion=1.0.3
77
# Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
88
pluginSinceBuild=223
99
# IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension

extensions/vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "continue",
33
"icon": "media/icon.png",
44
"author": "Continue Dev, Inc",
5-
"version": "1.1.8",
5+
"version": "1.1.9",
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/continuedev/continue"

0 commit comments

Comments
 (0)