Args: Add subcommands to run actions

Migrate OpenAPI and sample config export to subcommands "export-openapi"
and "export-config".

Also add a "download" subcommand that passes args to the TabbyAPI
downloader. This allows models to be downloaded via the API and
CLI args.

Signed-off-by: kingbri <8082010+kingbri1@users.noreply.github.com>
This commit is contained in:
kingbri 2025-02-10 23:14:22 -05:00
parent 30f02e5453
commit 30ab8e04b9
6 changed files with 112 additions and 31 deletions

View file

@ -275,8 +275,6 @@ if __name__ == "__main__":
from common.args import convert_args_to_dict
from main import entrypoint
converted_args = convert_args_to_dict(args, parser)
# Create a config if it doesn't exist
# This is not necessary to run TabbyAPI, but is new user proof
config_path = (
@ -292,7 +290,7 @@ if __name__ == "__main__":
)
print("Starting TabbyAPI...")
entrypoint(converted_args)
entrypoint(args, parser)
except (ModuleNotFoundError, ImportError):
traceback.print_exc()
print(