fix: 🐛 fix incorrect imports in default config file
This commit is contained in:
parent
cb0c815ad7
commit
374bdd0377
5 changed files with 28 additions and 25 deletions
|
|
@ -1,4 +1,5 @@
|
|||
from functools import cached_property
|
||||
import traceback
|
||||
from typing import Coroutine, Dict, Union
|
||||
import os
|
||||
|
||||
|
|
@ -162,11 +163,15 @@ class ContinueSDK(AbstractContinueSDK):
|
|||
config = sdk._load_config_dot_py()
|
||||
sdk.config = config
|
||||
except Exception as e:
|
||||
logger.debug(e)
|
||||
sdk.config = ContinueConfig()
|
||||
logger.error(f"Failed to load config.py: {e}")
|
||||
|
||||
sdk.config = ContinueConfig(
|
||||
) if sdk._last_valid_config is None else sdk._last_valid_config
|
||||
|
||||
formatted_err = '\n'.join(traceback.format_exception(e))
|
||||
msg_step = MessageStep(
|
||||
name="Invalid Continue Config File", message=e.__repr__())
|
||||
msg_step.description = e.__repr__()
|
||||
name="Invalid Continue Config File", message=formatted_err)
|
||||
msg_step.description = f"Falling back to default config settings.\n```\n{formatted_err}\n```"
|
||||
sdk.history.add_node(HistoryNode(
|
||||
step=msg_step,
|
||||
observation=None,
|
||||
|
|
@ -174,6 +179,10 @@ class ContinueSDK(AbstractContinueSDK):
|
|||
active=False
|
||||
))
|
||||
|
||||
# When the config is loaded, setup posthog logger
|
||||
posthog_logger.setup(
|
||||
sdk.ide.unique_id, sdk.config.allow_anonymous_telemetry)
|
||||
|
||||
sdk.models = await Models.create(sdk)
|
||||
return sdk
|
||||
|
||||
|
|
@ -261,21 +270,14 @@ class ContinueSDK(AbstractContinueSDK):
|
|||
def _load_config_dot_py(self) -> ContinueConfig:
|
||||
# Use importlib to load the config file config.py at the given path
|
||||
path = getConfigFilePath()
|
||||
try:
|
||||
import importlib.util
|
||||
spec = importlib.util.spec_from_file_location("config", path)
|
||||
config = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(config)
|
||||
self._last_valid_config = config.config
|
||||
|
||||
# When the config is loaded, setup posthog logger
|
||||
posthog_logger.setup(
|
||||
self.ide.unique_id, config.config.allow_anonymous_telemetry)
|
||||
import importlib.util
|
||||
spec = importlib.util.spec_from_file_location("config", path)
|
||||
config = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(config)
|
||||
self._last_valid_config = config.config
|
||||
|
||||
return config.config
|
||||
except Exception as e:
|
||||
logger.debug(f"Error loading config.py: {e}")
|
||||
return ContinueConfig() if self._last_valid_config is None else self._last_valid_config
|
||||
return config.config
|
||||
|
||||
def get_code_context(self, only_editing: bool = False) -> List[RangeInFileWithContents]:
|
||||
highlighted_ranges = self.__autopilot.context_manager.context_providers[
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ be sure to select the Python interpreter in ~/.continue/server/env.
|
|||
|
||||
import subprocess
|
||||
|
||||
from continuedev.src.continuedev.core.main import Step
|
||||
from continuedev.src.continuedev.core.sdk import ContinueSDK
|
||||
from continuedev.src.continuedev.core.config import CustomCommand, SlashCommand, ContinueConfig
|
||||
from continuedev.src.continuedev.plugins.context_providers.github import GitHubIssuesContextProvider
|
||||
from continuedev.src.continuedev.plugins.context_providers.google import GoogleContextProvider
|
||||
from continuedev.core.main import Step
|
||||
from continuedev.core.sdk import ContinueSDK
|
||||
from continuedev.core.config import CustomCommand, SlashCommand, ContinueConfig
|
||||
from continuedev.plugins.context_providers.github import GitHubIssuesContextProvider
|
||||
from continuedev.plugins.context_providers.google import GoogleContextProvider
|
||||
|
||||
|
||||
class CommitMessageStep(Step):
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ class PostHogLogger:
|
|||
self.posthog = Posthog(self.api_key, host='https://app.posthog.com')
|
||||
|
||||
def setup(self, unique_id: str, allow_anonymous_telemetry: bool):
|
||||
logger.debug(f"Setting unique_id as {unique_id}")
|
||||
self.unique_id = unique_id or "NO_UNIQUE_ID"
|
||||
self.allow_anonymous_telemetry = allow_anonymous_telemetry or True
|
||||
|
||||
|
|
|
|||
4
extension/package-lock.json
generated
4
extension/package-lock.json
generated
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "continue",
|
||||
"version": "0.0.220",
|
||||
"version": "0.0.221",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "continue",
|
||||
"version": "0.0.220",
|
||||
"version": "0.0.221",
|
||||
"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.220",
|
||||
"version": "0.0.221",
|
||||
"publisher": "Continue",
|
||||
"engines": {
|
||||
"vscode": "^1.67.0"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue