From b144d21b48a94aa8c203469eb7667bd22fc4e243 Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 29 Aug 2023 18:45:48 -0700 Subject: fix: :bug: fix 2 model config bugs --- continuedev/src/continuedev/core/models.py | 3 ++- continuedev/src/continuedev/libs/util/edit_config.py | 16 ++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/continuedev/src/continuedev/core/models.py b/continuedev/src/continuedev/core/models.py index f03a8f29..f3bf8125 100644 --- a/continuedev/src/continuedev/core/models.py +++ b/continuedev/src/continuedev/core/models.py @@ -10,7 +10,7 @@ from ..libs.llm.ollama import Ollama from ..libs.llm.openai import OpenAI from ..libs.llm.replicate import ReplicateLLM from ..libs.llm.together import TogetherLLM - +from ..libs.llm.llamacpp import LlamaCpp class ContinueSDK(BaseModel): pass @@ -35,6 +35,7 @@ MODEL_CLASSES = { AnthropicLLM, ReplicateLLM, Ollama, + LlamaCpp ] } diff --git a/continuedev/src/continuedev/libs/util/edit_config.py b/continuedev/src/continuedev/libs/util/edit_config.py index 7bdffc8e..3dd4646c 100644 --- a/continuedev/src/continuedev/libs/util/edit_config.py +++ b/continuedev/src/continuedev/libs/util/edit_config.py @@ -5,11 +5,14 @@ import redbaron from .paths import getConfigFilePath - -def load_red(): +def get_config_source(): config_file_path = getConfigFilePath() with open(config_file_path, "r") as file: source_code = file.read() + return source_code + +def load_red(): + source_code = get_config_source() red = redbaron.RedBaron(source_code) return red @@ -54,12 +57,13 @@ def edit_config_property(key_path: List[str], value: redbaron.RedBaron): def add_config_import(line: str): + # check if the import already exists + source = get_config_source() + if line in source: + return + with edit_lock: red = load_red() - # check if the import already exists - for node in red: - if node.type == "import" and node.dumps() == line: - return # if it doesn't exist, add it red.insert(1, line) -- cgit v1.2.3-70-g09d2