mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-04-20 14:28:54 +00:00
Tree: Update to cleanup globals
Use the module singleton pattern to share global state. This can also be a modified version of the Global Object Pattern. The main reason this pattern is used is for ease of use when handling global state rather than adding extra dependencies for a DI parameter. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@@ -6,15 +6,15 @@ from loguru import logger
|
||||
from typing import Dict, Optional
|
||||
|
||||
|
||||
class LogPreferences(BaseModel):
|
||||
class GenLogPreferences(BaseModel):
|
||||
"""Logging preference config."""
|
||||
|
||||
prompt: bool = False
|
||||
generation_params: bool = False
|
||||
|
||||
|
||||
# Global reference to logging preferences
|
||||
PREFERENCES = LogPreferences()
|
||||
# Global logging preferences constant
|
||||
PREFERENCES = GenLogPreferences()
|
||||
|
||||
|
||||
def update_from_dict(options_dict: Dict[str, bool]):
|
||||
@@ -26,7 +26,7 @@ def update_from_dict(options_dict: Dict[str, bool]):
|
||||
if value is None:
|
||||
value = False
|
||||
|
||||
PREFERENCES = LogPreferences.model_validate(options_dict)
|
||||
PREFERENCES = GenLogPreferences.model_validate(options_dict)
|
||||
|
||||
|
||||
def broadcast_status():
|
||||
|
||||
Reference in New Issue
Block a user