Handle missing api key without exception #559

This commit is contained in:
Paul Gauthier 2024-04-15 12:29:49 -07:00
parent 9b2e697584
commit 7699866802

View file

@ -544,7 +544,9 @@ def main(argv=None, input=None, output=None, force_git_root=None):
def scrub_sensitive_info(text):
# Replace sensitive information with placeholder
return text.replace(args.openai_api_key, "***")
if text and args.openai_api_key:
return text.replace(args.openai_api_key, "***")
return text
if args.verbose:
show = scrub_sensitive_info(parser.format_values())