From 2f45e978c56a5bc3c60a10394a60ade74a04f546 Mon Sep 17 00:00:00 2001 From: kingbri Date: Thu, 5 Sep 2024 18:04:53 -0400 Subject: [PATCH] API: Fix merge overwrite The completions utils did not take the new imports. Signed-off-by: kingbri --- endpoints/OAI/utils/completion.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/endpoints/OAI/utils/completion.py b/endpoints/OAI/utils/completion.py index cc752c52..d2795455 100644 --- a/endpoints/OAI/utils/completion.py +++ b/endpoints/OAI/utils/completion.py @@ -13,7 +13,7 @@ from loguru import logger -from common import config, model +from common import model from common.auth import get_key_permission from common.networking import ( get_generator_error, @@ -21,6 +21,7 @@ handle_request_error, request_disconnect_loop, ) +from common.tabby_config import config from common.utils import unwrap from endpoints.OAI.types.completion import ( CompletionRequest, @@ -115,8 +116,6 @@ async def load_inline_model(model_name: str, request: Request): if model.container and model.container.model_dir.name == model_name: return - model_config = config.model_config() - # Inline model loading isn't enabled or the user isn't an admin if not get_key_permission(request) == "admin": error_message = handle_request_error( @@ -127,7 +126,7 @@ async def load_inline_model(model_name: str, request: Request): raise HTTPException(401, error_message) - if not unwrap(model_config.get("inline_model_loading"), False): + if not unwrap(config.model.get("inline_model_loading"), False): logger.warning( f"Unable to switch model to {model_name} because " '"inline_model_load" is not True in config.yml.' @@ -135,7 +134,7 @@ async def load_inline_model(model_name: str, request: Request): return - model_path = pathlib.Path(unwrap(model_config.get("model_dir"), "models")) + model_path = pathlib.Path(unwrap(config.model.get("model_dir"), "models")) model_path = model_path / model_name # Model path doesn't exist