mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-02 10:45:00 +00:00
be careful logging main_models that are not in the model db
This commit is contained in:
parent
a7a626423c
commit
aa840f0e28
3 changed files with 16 additions and 4 deletions
|
@ -7,6 +7,7 @@ from pathlib import Path
|
||||||
from mixpanel import Mixpanel
|
from mixpanel import Mixpanel
|
||||||
|
|
||||||
from aider import __version__
|
from aider import __version__
|
||||||
|
from aider.dump import dump # noqa: F401
|
||||||
|
|
||||||
|
|
||||||
class Analytics:
|
class Analytics:
|
||||||
|
@ -46,6 +47,13 @@ class Analytics:
|
||||||
return
|
return
|
||||||
|
|
||||||
properties = {}
|
properties = {}
|
||||||
|
|
||||||
|
if main_model:
|
||||||
|
if main_model.info:
|
||||||
|
properties["main_model"] = main_model.name
|
||||||
|
elif "/" in main_model.name:
|
||||||
|
properties["main_model"] = main_model.name.split("/")[0] + "/REDACTED"
|
||||||
|
|
||||||
properties.update(kwargs)
|
properties.update(kwargs)
|
||||||
properties.update(self.get_system_info()) # Add system info to all events
|
properties.update(self.get_system_info()) # Add system info to all events
|
||||||
|
|
||||||
|
|
|
@ -1412,13 +1412,13 @@ class Coder:
|
||||||
)
|
)
|
||||||
|
|
||||||
self.event(
|
self.event(
|
||||||
"token_usage",
|
"message_send",
|
||||||
|
main_model=self.main_model,
|
||||||
prompt_tokens=prompt_tokens,
|
prompt_tokens=prompt_tokens,
|
||||||
completion_tokens=completion_tokens,
|
completion_tokens=completion_tokens,
|
||||||
total_tokens=prompt_tokens + completion_tokens,
|
total_tokens=prompt_tokens + completion_tokens,
|
||||||
cost=cost,
|
cost=cost,
|
||||||
total_cost=self.total_cost,
|
total_cost=self.total_cost,
|
||||||
model=self.main_model.name,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_multi_response_content(self, final=False):
|
def get_multi_response_content(self, final=False):
|
||||||
|
|
|
@ -373,9 +373,13 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
editingmode=editing_mode,
|
editingmode=editing_mode,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
analytics = Analytics(args.analytics)
|
||||||
|
analytics.event("launched")
|
||||||
|
|
||||||
if args.gui and not return_coder:
|
if args.gui and not return_coder:
|
||||||
if not check_streamlit_install(io):
|
if not check_streamlit_install(io):
|
||||||
return
|
return
|
||||||
|
analytics.event("gui session")
|
||||||
launch_gui(argv)
|
launch_gui(argv)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -497,8 +501,6 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
args.max_chat_history_tokens or main_model.max_chat_history_tokens,
|
args.max_chat_history_tokens or main_model.max_chat_history_tokens,
|
||||||
)
|
)
|
||||||
|
|
||||||
analytics = Analytics(args.analytics)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
coder = Coder.create(
|
coder = Coder.create(
|
||||||
main_model=main_model,
|
main_model=main_model,
|
||||||
|
@ -615,6 +617,8 @@ def main(argv=None, input=None, output=None, force_git_root=None, return_coder=F
|
||||||
if args.exit:
|
if args.exit:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
analytics.event("cli session", main_model=main_model)
|
||||||
|
|
||||||
thread = threading.Thread(target=load_slow_imports)
|
thread = threading.Thread(target=load_slow_imports)
|
||||||
thread.daemon = True
|
thread.daemon = True
|
||||||
thread.start()
|
thread.start()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue