Update __init__.py

This commit is contained in:
H Lohaus 2025-06-30 10:06:56 +02:00 committed by GitHub
parent 05bd5051b1
commit dcbeebd662
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -65,3 +65,21 @@ def run_api_args(args):
ssl_certfile=args.ssl_certfile,
log_config=args.log_config,
)
def main():
parser = argparse.ArgumentParser(description="Run gpt4free")
subparsers = parser.add_subparsers(dest="mode", help="Mode to run the g4f in.")
subparsers.add_parser("api", parents=[get_api_parser()], add_help=False)
subparsers.add_parser("gui", parents=[gui_parser()], add_help=False)
subparsers.add_parser("client", parents=[get_parser()], add_help=False)
args = parser.parse_args()
if args.mode == "api":
run_api_args(args)
elif args.mode == "gui":
run_gui_args(args)
elif args.mode == "client":
run_client_args(args)
else:
parser.print_help()
exit(1)