mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-15 00:07:28 +00:00
API + Model: Fix application of defaults
use_as_default was not being properly applied into model overrides. For compartmentalization's sake, apply all overrides in a single function to avoid clutter. In addition, fix where the traditional /v1/model/load endpoint checks for draft options. These can be applied via an inline config, so let any failures fallthrough. Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com>
This commit is contained in:
@@ -20,6 +20,7 @@ class TabbyConfig(TabbyConfigModel):
|
||||
# Persistent defaults
|
||||
# TODO: make this pydantic?
|
||||
model_defaults: dict = {}
|
||||
draft_model_defaults: dict = {}
|
||||
|
||||
def load(self, arguments: Optional[dict] = None):
|
||||
"""Synchronously loads the global application config"""
|
||||
@@ -50,7 +51,7 @@ class TabbyConfig(TabbyConfigModel):
|
||||
if hasattr(self.model, field):
|
||||
self.model_defaults[field] = getattr(config.model, field)
|
||||
elif hasattr(self.draft_model, field):
|
||||
self.model_defaults[field] = getattr(config.draft_model, field)
|
||||
self.draft_model_defaults[field] = getattr(config.draft_model, field)
|
||||
else:
|
||||
logger.error(
|
||||
f"invalid item {field} in config option `model.use_as_default`"
|
||||
|
||||
Reference in New Issue
Block a user