From 26d5fcd216a6832614a5750257ac8f4bb8dfa6b2 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Mon, 29 Apr 2024 16:56:56 +0200 Subject: Fix workers argument in api --- g4f/cli.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'g4f/cli.py') diff --git a/g4f/cli.py b/g4f/cli.py index 9037a6f1..38bc9cc1 100644 --- a/g4f/cli.py +++ b/g4f/cli.py @@ -16,9 +16,9 @@ def main(): api_parser.add_argument("--workers", type=int, default=None, help="Number of workers.") api_parser.add_argument("--disable-colors", action="store_true", help="Don't use colors.") api_parser.add_argument("--ignore-cookie-files", action="store_true", help="Don't read .har and cookie files.") - api_parser.add_argument("--g4f-api-key", type=str, default=None, help="Sets an authentication key for your API.") - api_parser.add_argument("--ignored-providers", nargs="+", choices=[provider for provider in Provider.__map__], - default=[], help="List of providers to ignore when processing request.") + api_parser.add_argument("--g4f-api-key", type=str, default=None, help="Sets an authentication key for your API. (incompatible with --debug and --workers)") + api_parser.add_argument("--ignored-providers", nargs="+", choices=[provider.__name__ for provider in Provider.__providers__ if provider.working], + default=[], help="List of providers to ignore when processing request. (incompatible with --debug and --workers)") subparsers.add_parser("gui", parents=[gui_parser()], add_help=False) args = parser.parse_args() @@ -39,11 +39,13 @@ def run_api_args(args): g4f.api.set_list_ignored_providers( args.ignored_providers ) + g4f.api.set_g4f_api_key( + args.g4f_api_key + ) g4f.api.run_api( bind=args.bind, debug=args.debug, workers=args.workers, - g4f_api_key=args.g4f_api_key, use_colors=not args.disable_colors ) -- cgit v1.2.3