Replaced API keys with last 4 characters for debugging purposes.

This commit is contained in:
Paul Gauthier (aider) 2024-07-17 14:02:19 +01:00
parent e9904172f1
commit 24e34a4a8d

View file

@ -140,11 +140,13 @@ def format_settings(parser, args):
def scrub_sensitive_info(args, text):
# Replace sensitive information with placeholder
# Replace sensitive information with last 4 characters
if text and args.openai_api_key:
text = text.replace(args.openai_api_key, "***")
last_4 = args.openai_api_key[-4:]
text = text.replace(args.openai_api_key, f"...{last_4}")
if text and args.anthropic_api_key:
text = text.replace(args.anthropic_api_key, "***")
last_4 = args.anthropic_api_key[-4:]
text = text.replace(args.anthropic_api_key, f"...{last_4}")
return text