fix: 🐛 fix 2 model config bugs
This commit is contained in:
parent
12fa2d2667
commit
b144d21b48
2 changed files with 12 additions and 7 deletions
|
|
@ -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
|
||||
]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue