mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-28 16:25:00 +00:00
refactor: move scrub_sensitive_info to format_settings.py
This commit is contained in:
parent
93c089c5ec
commit
2b2ab3994d
2 changed files with 10 additions and 13 deletions
|
@ -1,4 +1,12 @@
|
||||||
from aider.utils import scrub_sensitive_info
|
def scrub_sensitive_info(args, text):
|
||||||
|
# Replace sensitive information with last 4 characters
|
||||||
|
if text and 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:
|
||||||
|
last_4 = args.anthropic_api_key[-4:]
|
||||||
|
text = text.replace(args.anthropic_api_key, f"...{last_4}")
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
def format_settings(parser, args):
|
def format_settings(parser, args):
|
||||||
|
|
|
@ -13,7 +13,7 @@ from aider import __version__, models, utils
|
||||||
from aider.args import get_parser
|
from aider.args import get_parser
|
||||||
from aider.coders import Coder
|
from aider.coders import Coder
|
||||||
from aider.commands import Commands, SwitchCoder
|
from aider.commands import Commands, SwitchCoder
|
||||||
from aider.format_settings import format_settings
|
from aider.format_settings import format_settings, scrub_sensitive_info
|
||||||
from aider.history import ChatSummary
|
from aider.history import ChatSummary
|
||||||
from aider.io import InputOutput
|
from aider.io import InputOutput
|
||||||
from aider.llm import litellm # noqa: F401; properly init litellm on launch
|
from aider.llm import litellm # noqa: F401; properly init litellm on launch
|
||||||
|
@ -133,17 +133,6 @@ def check_gitignore(git_root, io, ask=True):
|
||||||
io.tool_output(f"Added {pat} to .gitignore")
|
io.tool_output(f"Added {pat} to .gitignore")
|
||||||
|
|
||||||
|
|
||||||
def scrub_sensitive_info(args, text):
|
|
||||||
# Replace sensitive information with last 4 characters
|
|
||||||
if text and 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:
|
|
||||||
last_4 = args.anthropic_api_key[-4:]
|
|
||||||
text = text.replace(args.anthropic_api_key, f"...{last_4}")
|
|
||||||
return text
|
|
||||||
|
|
||||||
|
|
||||||
def check_streamlit_install(io):
|
def check_streamlit_install(io):
|
||||||
return utils.check_pip_install_extra(
|
return utils.check_pip_install_extra(
|
||||||
io,
|
io,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue