refactor: simplify event method to use main_model attributes

This commit is contained in:
Paul Gauthier (aider) 2024-10-31 10:08:43 -07:00
parent 8e098752bd
commit e4913669d4

View file

@ -119,8 +119,7 @@ class Analytics:
return model.name.split("/")[0] + "/REDACTED"
return None
# ai: actually, weak_model and editor_model are attributes of main_model; use them instead!
def event(self, event_name, main_model=None, weak_model=None, editor_model=None, **kwargs):
def event(self, event_name, main_model=None, **kwargs):
if not (self.mp or self.ph) and not self.logfile:
return
@ -128,12 +127,8 @@ class Analytics:
if main_model:
properties["main_model"] = self._redact_model_name(main_model)
if weak_model:
properties["weak_model"] = self._redact_model_name(weak_model)
if editor_model:
properties["editor_model"] = self._redact_model_name(editor_model)
properties["weak_model"] = self._redact_model_name(main_model.weak_model)
properties["editor_model"] = self._redact_model_name(main_model.editor_model)
properties.update(kwargs)
properties.update(self.get_system_info()) # Add system info to all events