error handle on invalid config file, don't immediately show loading message
This commit is contained in:
parent
a7ab1918f8
commit
53ac7b93f4
12 changed files with 88 additions and 29 deletions
|
|
@ -15,7 +15,7 @@ from ..libs.llm.anthropic import AnthropicLLM
|
|||
from ..libs.llm.ggml import GGML
|
||||
from .observation import Observation
|
||||
from ..server.ide_protocol import AbstractIdeProtocolServer
|
||||
from .main import Context, ContinueCustomException, History, Step, ChatMessage
|
||||
from .main import Context, ContinueCustomException, History, HistoryNode, Step, ChatMessage
|
||||
from ..steps.core.core import *
|
||||
from ..libs.llm.proxy_server import ProxyServer
|
||||
|
||||
|
|
@ -155,6 +155,23 @@ class ContinueSDK(AbstractContinueSDK):
|
|||
@classmethod
|
||||
async def create(cls, autopilot: Autopilot) -> "ContinueSDK":
|
||||
sdk = ContinueSDK(autopilot)
|
||||
|
||||
try:
|
||||
config = sdk._load_config()
|
||||
sdk.config = config
|
||||
except Exception as e:
|
||||
print(e)
|
||||
sdk.config = ContinueConfig()
|
||||
msg_step = MessageStep(
|
||||
name="Invalid Continue Config File", message=e.__repr__())
|
||||
msg_step.description = e.__repr__()
|
||||
sdk.history.add_node(HistoryNode(
|
||||
step=msg_step,
|
||||
observation=None,
|
||||
depth=0,
|
||||
active=False
|
||||
))
|
||||
|
||||
sdk.models = await Models.create(sdk)
|
||||
return sdk
|
||||
|
||||
|
|
|
|||
4
extension/package-lock.json
generated
4
extension/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.0.179",
|
||||
"version": "0.0.181",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.0.179",
|
||||
"version": "0.0.181",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@electron/rebuild": "^3.2.10",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
"displayName": "Continue",
|
||||
"pricing": "Free",
|
||||
"description": "The open-source coding autopilot",
|
||||
"version": "0.0.179",
|
||||
"version": "0.0.181",
|
||||
"publisher": "Continue",
|
||||
"engines": {
|
||||
"vscode": "^1.67.0"
|
||||
|
|
|
|||
2
extension/schema/FullState.d.ts
vendored
2
extension/schema/FullState.d.ts
vendored
|
|
@ -21,6 +21,7 @@ export type ManageOwnChatContext = boolean;
|
|||
export type Depth = number;
|
||||
export type Deleted = boolean;
|
||||
export type Active = boolean;
|
||||
export type Logs = string[];
|
||||
export type Timeline = HistoryNode[];
|
||||
export type CurrentIndex = number;
|
||||
export type Active1 = boolean;
|
||||
|
|
@ -69,6 +70,7 @@ export interface HistoryNode {
|
|||
depth: Depth;
|
||||
deleted?: Deleted;
|
||||
active?: Active;
|
||||
logs?: Logs;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Step {
|
||||
|
|
|
|||
2
extension/schema/History.d.ts
vendored
2
extension/schema/History.d.ts
vendored
|
|
@ -21,6 +21,7 @@ export type ManageOwnChatContext = boolean;
|
|||
export type Depth = number;
|
||||
export type Deleted = boolean;
|
||||
export type Active = boolean;
|
||||
export type Logs = string[];
|
||||
export type Timeline = HistoryNode[];
|
||||
export type CurrentIndex = number;
|
||||
|
||||
|
|
@ -41,6 +42,7 @@ export interface HistoryNode {
|
|||
depth: Depth;
|
||||
deleted?: Deleted;
|
||||
active?: Active;
|
||||
logs?: Logs;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Step {
|
||||
|
|
|
|||
2
extension/schema/HistoryNode.d.ts
vendored
2
extension/schema/HistoryNode.d.ts
vendored
|
|
@ -21,6 +21,7 @@ export type ManageOwnChatContext = boolean;
|
|||
export type Depth = number;
|
||||
export type Deleted = boolean;
|
||||
export type Active = boolean;
|
||||
export type Logs = string[];
|
||||
|
||||
/**
|
||||
* A point in history, a list of which make up History
|
||||
|
|
@ -31,6 +32,7 @@ export interface HistoryNode1 {
|
|||
depth: Depth;
|
||||
deleted?: Deleted;
|
||||
active?: Active;
|
||||
logs?: Logs;
|
||||
[k: string]: unknown;
|
||||
}
|
||||
export interface Step {
|
||||
|
|
|
|||
|
|
@ -36,22 +36,44 @@ export async function activateExtension(context: vscode.ExtensionContext) {
|
|||
})
|
||||
.catch((e) => console.log("Error checking for extension updates: ", e));
|
||||
|
||||
// Start the Python server
|
||||
await new Promise((resolve, reject) => {
|
||||
vscode.window.withProgress(
|
||||
{
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
title:
|
||||
"Starting Continue Server... (it may take a minute to download Python packages)",
|
||||
cancellable: false,
|
||||
},
|
||||
async (progress, token) => {
|
||||
await startContinuePythonServer();
|
||||
resolve(null);
|
||||
// Wrap the server start logic in a new Promise
|
||||
const serverStartPromise = new Promise((resolve, reject) => {
|
||||
let serverStarted = false;
|
||||
|
||||
// Start the server and set serverStarted to true when done
|
||||
startContinuePythonServer().then(() => {
|
||||
serverStarted = true;
|
||||
resolve(null);
|
||||
});
|
||||
|
||||
// Wait for 2 seconds
|
||||
setTimeout(() => {
|
||||
// If the server hasn't started after 2 seconds, show the notification
|
||||
if (!serverStarted) {
|
||||
vscode.window.withProgress(
|
||||
{
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
title:
|
||||
"Starting Continue Server... (it may take a minute to download Python packages)",
|
||||
cancellable: false,
|
||||
},
|
||||
async (progress, token) => {
|
||||
// Wait for the server to start
|
||||
while (!serverStarted) {
|
||||
await new Promise((innerResolve) =>
|
||||
setTimeout(innerResolve, 1000)
|
||||
);
|
||||
}
|
||||
return Promise.resolve();
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}, 2000);
|
||||
});
|
||||
|
||||
// Await the server start promise
|
||||
await serverStartPromise;
|
||||
|
||||
// Register commands and providers
|
||||
sendTelemetryEvent(TelemetryEvent.ExtensionActivated);
|
||||
registerAllCodeLensProviders(context);
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ async function retryThenFail(
|
|||
|
||||
// Show corresponding error message depending on the platform
|
||||
let msg =
|
||||
"Failed to set up Continue extension. Please email nate@continue.dev and we'll get this fixed ASAP!";
|
||||
"Failed to set up Continue extension. Please email hi@continue.dev and we'll get this fixed ASAP!";
|
||||
try {
|
||||
switch (process.platform) {
|
||||
case "win32":
|
||||
|
|
|
|||
|
|
@ -17,15 +17,5 @@ async function dynamicImportAndActivate(context: vscode.ExtensionContext) {
|
|||
}
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
// Only show progress if we have to setup
|
||||
vscode.window.withProgress(
|
||||
{
|
||||
location: vscode.ProgressLocation.Notification,
|
||||
title: "Setting up Continue extension...",
|
||||
cancellable: false,
|
||||
},
|
||||
async () => {
|
||||
dynamicImportAndActivate(context);
|
||||
}
|
||||
);
|
||||
dynamicImportAndActivate(context);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,6 +120,14 @@
|
|||
"title": "Active",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"logs": {
|
||||
"title": "Logs",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
|
|||
|
|
@ -120,6 +120,14 @@
|
|||
"title": "Active",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"logs": {
|
||||
"title": "Logs",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
|
|||
|
|
@ -120,6 +120,14 @@
|
|||
"title": "Active",
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"logs": {
|
||||
"title": "Logs",
|
||||
"default": [],
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue