From 0d4ae098a2b049cfd3d726b121c2d42dfad37701 Mon Sep 17 00:00:00 2001 From: Randy Mackay Date: Wed, 20 Dec 2023 19:28:29 +0900 Subject: [PATCH] fixup file checker --- .../assistant_setup/assistant_file_checker.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/MAVProxy/modules/mavproxy_chat/assistant_setup/assistant_file_checker.py b/MAVProxy/modules/mavproxy_chat/assistant_setup/assistant_file_checker.py index 600455bc49..49de7c280f 100644 --- a/MAVProxy/modules/mavproxy_chat/assistant_setup/assistant_file_checker.py +++ b/MAVProxy/modules/mavproxy_chat/assistant_setup/assistant_file_checker.py @@ -9,7 +9,7 @@ OpenAI Assistant Playground: https://platform.openai.com/playground ''' -import datetime +import datetime, os try: from openai import OpenAI @@ -97,8 +97,12 @@ def get_filename_size_date_from_id(files_list, file_id): # parse command line arguments from argparse import ArgumentParser - parser = ArgumentParser(description="MAVProxy AI chat module OpenAI Assistant setup script") + parser = ArgumentParser(description="MAVProxy Chat Module Assistant File Checker") parser.add_argument("--api-key", default=None, help="OpenAI API Key") parser.add_argument("--delete-unused", action='store_true', help="delete unused files") - args = parser.parse_args() + try: + args = parser.parse_args() + except AttributeError as err: + parser.print_help() + os.sys.exit(0) main(openai_api_key=args.api_key, delete_unused=args.delete_unused)