mirror of
https://github.com/theroyallab/tabbyAPI.git
synced 2026-03-15 00:07:28 +00:00
Config: Add override argparser
Add an argparser that casts over to dictionaries of subgroups to integrate with the config. This argparser doesn't contain everything in the config due to complexity issues with CLI args, but will eventually progress to parity. In addition, it's used to override the config.yml rather than replace it. A config arg is also provided if the user wants to fully override the config yaml with another file path. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
11
main.py
11
main.py
@@ -12,8 +12,10 @@ from functools import partial
|
||||
from progress.bar import IncrementalBar
|
||||
|
||||
import gen_logging
|
||||
from args import convert_args_to_dict, init_argparser
|
||||
from auth import check_admin_key, check_api_key, load_auth_keys
|
||||
from config import (
|
||||
override_config_from_args,
|
||||
read_config_from_file,
|
||||
get_gen_logging_config,
|
||||
get_model_config,
|
||||
@@ -493,13 +495,20 @@ async def generate_chat_completion(request: Request, data: ChatCompletionRequest
|
||||
return response
|
||||
|
||||
|
||||
def entrypoint():
|
||||
def entrypoint(args: Optional[dict] = None):
|
||||
"""Entry function for program startup"""
|
||||
global MODEL_CONTAINER
|
||||
|
||||
# Load from YAML config
|
||||
read_config_from_file(pathlib.Path("config.yml"))
|
||||
|
||||
# Parse and override config from args
|
||||
if args is None:
|
||||
parser = init_argparser()
|
||||
args = convert_args_to_dict(parser.parse_args(), parser)
|
||||
|
||||
override_config_from_args(args)
|
||||
|
||||
network_config = get_network_config()
|
||||
|
||||
# Initialize auth keys
|
||||
|
||||
Reference in New Issue
Block a user