From 62e2f9a1e9ba09d8e5d8a251a92c3dba7a02c2fa Mon Sep 17 00:00:00 2001 From: rex <1073853456@qq.com> Date: Wed, 15 Nov 2023 21:13:45 +0800 Subject: [PATCH] use pprint and valid all models --- askchat/askchat.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/askchat/askchat.py b/askchat/askchat.py index 51153d9..4f1ff17 100644 --- a/askchat/askchat.py +++ b/askchat/askchat.py @@ -3,6 +3,7 @@ import asyncio from argparse import ArgumentParser import askchat +from pprint import pprint VERSION = askchat.__version__ # print the response in a typewriter way @@ -34,7 +35,8 @@ def main(): parser.add_argument('message', help='User message', default='', nargs='*') parser.add_argument('-v', '--version', action='version', version=VERSION) parser.add_argument('--debug', action='store_true', help='Print debug log') - parser.add_argument('--valid-models', action='store_true', help='Print valid models') + parser.add_argument('--valid-models', action='store_true', help='Print valid models that contain "gpt" in their names') + parser.add_argument('--all-valid-models', action='store_true', help='Print all valid models') parser.add_argument('-m', '--model', default=None, help='Model name') args = parser.parse_args() # show debug log @@ -43,8 +45,12 @@ def main(): return # show valid models if args.valid_models: - print('Valid models: ') - print(Chat().get_valid_models()) + print('Valid models that contain "gpt" in their names:') + pprint(Chat().get_valid_models()) + return + if args.all_valid_models: + print('All valid models:') + pprint(Chat().get_valid_models(gpt_only=False)) return # get message and model model, msg = args.model, args.message