mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 01:04:59 +00:00
refactor: improve model name redaction in analytics and model info handling
This commit is contained in:
parent
a565a63436
commit
e94e60b1d2
3 changed files with 8 additions and 5 deletions
|
@ -114,7 +114,9 @@ class Analytics:
|
||||||
properties = {}
|
properties = {}
|
||||||
|
|
||||||
if main_model:
|
if main_model:
|
||||||
if main_model.info:
|
# Redact the main model name unless it is in the public litellm db
|
||||||
|
info = model_info_manager.get_model_from_cached_json_db(main_model.name)
|
||||||
|
if info:
|
||||||
properties["main_model"] = main_model.name
|
properties["main_model"] = main_model.name
|
||||||
elif "/" in main_model.name:
|
elif "/" in main_model.name:
|
||||||
properties["main_model"] = main_model.name.split("/")[0] + "/REDACTED"
|
properties["main_model"] = main_model.name.split("/")[0] + "/REDACTED"
|
||||||
|
|
|
@ -266,7 +266,7 @@ class Coder:
|
||||||
suggest_shell_commands=True,
|
suggest_shell_commands=True,
|
||||||
chat_language=None,
|
chat_language=None,
|
||||||
):
|
):
|
||||||
self.analytics = analytics if analytics is not None else Analytics(enable=False)
|
self.analytics = analytics if analytics is not None else Analytics()
|
||||||
self.event = self.analytics.event
|
self.event = self.analytics.event
|
||||||
self.chat_language = chat_language
|
self.chat_language = chat_language
|
||||||
self.commit_before_message = []
|
self.commit_before_message = []
|
||||||
|
|
|
@ -691,9 +691,10 @@ class ModelInfoManager:
|
||||||
return dict()
|
return dict()
|
||||||
|
|
||||||
def get_model_info(self, model):
|
def get_model_info(self, model):
|
||||||
info = self.get_model_from_cached_json_db(model)
|
if not litellm._lazy_module:
|
||||||
if info:
|
info = self.get_model_from_cached_json_db(model)
|
||||||
return info
|
if info:
|
||||||
|
return info
|
||||||
|
|
||||||
# If all else fails, do it the slow way...
|
# If all else fails, do it the slow way...
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue