From 8218d085f75ebd0bd55a7e7526ca72cfaddc49f6 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 26 Nov 2024 12:31:54 -0800 Subject: [PATCH 01/13] fix: update Claude 3 model aliases to 3.5 versions --- aider/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aider/models.py b/aider/models.py index 9f40f0d8b..071c1fd6e 100644 --- a/aider/models.py +++ b/aider/models.py @@ -64,8 +64,8 @@ ANTHROPIC_MODELS = [ln.strip() for ln in ANTHROPIC_MODELS.splitlines() if ln.str # Mapping of model aliases to their canonical names MODEL_ALIASES = { # Claude models - "sonnet": "claude-3-sonnet-20241022", - "haiku": "claude-3-haiku-20241022", + "sonnet": "claude-3-5-sonnet-20241022", + "haiku": "claude-3-5-haiku-20241022", "opus": "claude-3-opus-20240229", # GPT models "4": "gpt-4-0613", @@ -837,7 +837,10 @@ model_info_manager = ModelInfoManager() class Model(ModelSettings): def __init__(self, model, weak_model=None, editor_model=None, editor_edit_format=None): # Map any alias to its canonical name - self.name = MODEL_ALIASES.get(model, model) + model = MODEL_ALIASES.get(model, model) + + self.name = model + self.max_chat_history_tokens = 1024 self.weak_model = None self.editor_model = None From 401ce7a63dc6174439f33345abfc0cba955c9293 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 26 Nov 2024 12:32:08 -0800 Subject: [PATCH 02/13] copy --- aider/website/assets/sample-analytics.jsonl | 58 ++++++++++----------- aider/website/docs/config/model-aliases.md | 4 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/aider/website/assets/sample-analytics.jsonl b/aider/website/assets/sample-analytics.jsonl index 9b83086c6..7c5f7ab62 100644 --- a/aider/website/assets/sample-analytics.jsonl +++ b/aider/website/assets/sample-analytics.jsonl @@ -1,32 +1,3 @@ -{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 10983, "completion_tokens": 334, "total_tokens": 11317, "cost": 0.037959, "total_cost": 0.156204, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048614} -{"event": "command_exit", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048627} -{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048688} -{"event": "gui session", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048689} -{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048852} -{"event": "cli session", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048854} -{"event": "command_run", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048858} -{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048860} -{"event": "gui session", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048861} -{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 31977, "completion_tokens": 328, "total_tokens": 32305, "cost": 0.100851, "total_cost": 0.100851, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048899} -{"event": "command_clear", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048919} -{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 14428, "completion_tokens": 683, "total_tokens": 15111, "cost": 0.05352900000000001, "total_cost": 0.15438000000000002, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048935} -{"event": "command_clear", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048937} -{"event": "command_run", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048950} -{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 26703, "completion_tokens": 233, "total_tokens": 26936, "cost": 0.083604, "total_cost": 0.23798400000000003, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048960} -{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 14705, "completion_tokens": 329, "total_tokens": 15034, "cost": 0.04905, "total_cost": 0.287034, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732048995} -{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732049208} -{"event": "gui session", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732049209} -{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055291} -{"event": "cli session", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055293} -{"event": "command_help", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055299} -{"event": "interactive help", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055299} -{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "help", "prompt_tokens": 4129, "completion_tokens": 103, "total_tokens": 4232, "cost": 0.013932, "total_cost": 0.013932, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055315} -{"event": "command_reset", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055336} -{"event": "command_help", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055340} -{"event": "interactive help", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055340} -{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "help", "prompt_tokens": 4027, "completion_tokens": 99, "total_tokens": 4126, "cost": 0.013566, "total_cost": 0.027498, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055348} -{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055652} -{"event": "gui session", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732055652} {"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732056472} {"event": "cli session", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732056474} {"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 4438, "completion_tokens": 340, "total_tokens": 4778, "cost": 0.018414, "total_cost": 0.018414, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732056484} @@ -998,3 +969,32 @@ {"event": "command_ask", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732640509} {"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "ask", "prompt_tokens": 3178, "completion_tokens": 768, "total_tokens": 3946, "cost": 0.021054000000000003, "total_cost": 0.032403, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732640525} {"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 5955, "completion_tokens": 0, "total_tokens": 5955, "cost": 0.017865, "total_cost": 0.050268, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732640621} +{"event": "command_clear", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732646529} +{"event": "command_editor", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732646548} +{"event": "command_ask", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732646648} +{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "ask", "prompt_tokens": 3003, "completion_tokens": 851, "total_tokens": 3854, "cost": 0.021774, "total_cost": 0.072042, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732646668} +{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 6090, "completion_tokens": 425, "total_tokens": 6515, "cost": 0.024645, "total_cost": 0.096687, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732646705} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732647498} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652841} +{"event": "model warning", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-sonnet-20241022", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652843} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652859} +{"event": "cli session", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652859} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652878} +{"event": "cli session", "properties": {"main_model": "claude-3-5-haiku-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-haiku-20241022", "edit_format": "diff", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652879} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652897} +{"event": "model warning", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-sonnet-20241022", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652898} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652933} +{"event": "model warning", "properties": {"main_model": "None", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "None", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652934} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652948} +{"event": "model warning", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-sonnet-20241022", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652950} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652962} +{"event": "model warning", "properties": {"main_model": "gpt-4-0613", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "gpt-4-0613", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652964} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652985} +{"event": "message_send", "properties": {"main_model": "gpt-4-0613", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "gpt-4-0613", "edit_format": "diff", "prompt_tokens": 2206, "completion_tokens": 9, "total_tokens": 2215, "cost": 0.06672, "total_cost": 0.06672, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732652988} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653075} +{"event": "message_send", "properties": {"main_model": "gpt-4-0613", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "gpt-4-0613", "edit_format": "diff", "prompt_tokens": 2206, "completion_tokens": 9, "total_tokens": 2215, "cost": 0.06672, "total_cost": 0.06672, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653077} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653082} +{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 2175, "completion_tokens": 113, "total_tokens": 2288, "cost": 0.00822, "total_cost": 0.00822, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653087} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653095} +{"event": "message_send", "properties": {"main_model": "claude-3-5-haiku-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-haiku-20241022", "edit_format": "diff", "prompt_tokens": 2175, "completion_tokens": 83, "total_tokens": 2258, "cost": 0.00259, "total_cost": 0.00259, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653101} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653110} diff --git a/aider/website/docs/config/model-aliases.md b/aider/website/docs/config/model-aliases.md index af5a12094..a5e7b1260 100644 --- a/aider/website/docs/config/model-aliases.md +++ b/aider/website/docs/config/model-aliases.md @@ -56,9 +56,9 @@ for alias, model in sorted(MODEL_ALIASES.items()): - `4-turbo`: gpt-4-1106-preview - `4o`: gpt-4o-2024-08-06 - `deepseek`: deepseek/deepseek-coder -- `haiku`: claude-3-haiku-20241022 +- `haiku`: claude-3-5-haiku-20241022 - `opus`: claude-3-opus-20240229 -- `sonnet`: claude-3-sonnet-20241022 +- `sonnet`: claude-3-5-sonnet-20241022 ## Priority From dd48b740f975e3bff713ca0e816ba6cc66cc7b2d Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 26 Nov 2024 12:33:58 -0800 Subject: [PATCH 03/13] test: update Claude model name tests to use 3.5 version --- tests/basic/test_models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/basic/test_models.py b/tests/basic/test_models.py index 8bf2ca44e..6aff2be7f 100644 --- a/tests/basic/test_models.py +++ b/tests/basic/test_models.py @@ -110,10 +110,10 @@ class TestModels(unittest.TestCase): self.assertEqual(model.name, "gpt-3.5-turbo") model = Model("sonnet") - self.assertEqual(model.name, "claude-3-sonnet-20241022") + self.assertEqual(model.name, "claude-3-5-sonnet-20241022") model = Model("haiku") - self.assertEqual(model.name, "claude-3-haiku-20241022") + self.assertEqual(model.name, "claude-3-5-haiku-20241022") model = Model("opus") self.assertEqual(model.name, "claude-3-opus-20240229") From 29a9b650edcb2ba208f14341886a00f190effb8e Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 26 Nov 2024 12:35:54 -0800 Subject: [PATCH 04/13] version bump to 0.65.1 --- aider/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aider/__init__.py b/aider/__init__.py index 67ff2a11a..6712cb077 100644 --- a/aider/__init__.py +++ b/aider/__init__.py @@ -1,6 +1,6 @@ try: from aider.__version__ import __version__ except Exception: - __version__ = "0.65.1.dev" + __version__ = "0.65.1" __all__ = [__version__] From 83a6865eb33121957eeb2ac9fa00c555ab26ec8f Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 26 Nov 2024 12:37:24 -0800 Subject: [PATCH 05/13] set version to 0.65.2.dev --- aider/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aider/__init__.py b/aider/__init__.py index 6712cb077..db056f0ff 100644 --- a/aider/__init__.py +++ b/aider/__init__.py @@ -1,6 +1,6 @@ try: from aider.__version__ import __version__ except Exception: - __version__ = "0.65.1" + __version__ = "0.65.2.dev" __all__ = [__version__] From 7972f5f4bcc8b54ba3b9f0c9f7153ff2c90424d0 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 26 Nov 2024 12:37:58 -0800 Subject: [PATCH 06/13] copy --- HISTORY.md | 4 ++++ aider/website/HISTORY.md | 4 ++++ aider/website/assets/sample-analytics.jsonl | 10 +++++----- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/HISTORY.md b/HISTORY.md index d1005a614..cba71b3fc 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,9 @@ # Release history +### Aider v0.65.1 + +- Bugfix to `--alias`. + ### Aider v0.65.0 - Added `--alias` config to define [custom model aliases](https://aider.chat/docs/config/model-aliases.html). diff --git a/aider/website/HISTORY.md b/aider/website/HISTORY.md index 6af61dbf8..1d33a219f 100644 --- a/aider/website/HISTORY.md +++ b/aider/website/HISTORY.md @@ -24,6 +24,10 @@ cog.out(text) ]]]--> +### Aider v0.65.1 + +- Bugfix to `--alias`. + ### Aider v0.65.0 - Added `--alias` config to define [custom model aliases](https://aider.chat/docs/config/model-aliases.html). diff --git a/aider/website/assets/sample-analytics.jsonl b/aider/website/assets/sample-analytics.jsonl index 7c5f7ab62..2f95f14fe 100644 --- a/aider/website/assets/sample-analytics.jsonl +++ b/aider/website/assets/sample-analytics.jsonl @@ -1,8 +1,3 @@ -{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732056472} -{"event": "cli session", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732056474} -{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 4438, "completion_tokens": 340, "total_tokens": 4778, "cost": 0.018414, "total_cost": 0.018414, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732056484} -{"event": "message_send", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "prompt_tokens": 5496, "completion_tokens": 115, "total_tokens": 5611, "cost": 0.018213, "total_cost": 0.036627, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732056500} -{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732056509} {"event": "cli session", "properties": {"main_model": "claude-3-5-sonnet-20241022", "weak_model": "claude-3-5-haiku-20241022", "editor_model": "claude-3-5-sonnet-20241022", "edit_format": "diff", "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732056511} {"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732063080} {"event": "gui session", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.63.3.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732063080} @@ -998,3 +993,8 @@ {"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653095} {"event": "message_send", "properties": {"main_model": "claude-3-5-haiku-20241022", "weak_model": "claude-3-5-sonnet-20241022", "editor_model": "claude-3-5-haiku-20241022", "edit_format": "diff", "prompt_tokens": 2175, "completion_tokens": 83, "total_tokens": 2258, "cost": 0.00259, "total_cost": 0.00259, "python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653101} {"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653110} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653234} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653313} +{"event": "gui session", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1.dev"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653314} +{"event": "launched", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653421} +{"event": "gui session", "properties": {"python_version": "3.12.6", "os_platform": "Darwin", "os_release": "23.6.0", "machine": "x86_64", "aider_version": "0.65.1"}, "user_id": "c42c4e6b-f054-44d7-ae1f-6726cc41da88", "time": 1732653422} From 60c29b28395713d7cd339a0f69d6d9cbcf9cecbe Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 26 Nov 2024 13:36:48 -0800 Subject: [PATCH 07/13] copy --- aider/website/_data/quant.yml | 25 +++++++++++++++- .../website/_posts/2024-11-21-quantization.md | 30 +++++++++++-------- 2 files changed, 41 insertions(+), 14 deletions(-) diff --git a/aider/website/_data/quant.yml b/aider/website/_data/quant.yml index 2be9e3cde..4d30e297c 100644 --- a/aider/website/_data/quant.yml +++ b/aider/website/_data/quant.yml @@ -296,4 +296,27 @@ date: 2024-11-24 versions: 0.64.2.dev seconds_per_case: 28.5 - total_cost: 0.1390 \ No newline at end of file + total_cost: 0.1390 + +- dirname: 2024-11-26-03-15-06--ollama-qwen2.5-coder:32b-instruct-fp16-2kctx + test_cases: 132 + model: "Ollama: fp16, 2k ctx" + edit_format: diff + commit_hash: 68be6c5-dirty, 554d274, 2ff3a23, 2ff3a23-dirty, 61759f9, dd48b74, 3ebd47d-dirty + pass_rate_1: 43.2 + pass_rate_2: 51.9 + percent_cases_well_formed: 46.2 + error_outputs: 171 + num_malformed_responses: 165 + num_with_malformed_responses: 71 + user_asks: 97 + lazy_comments: 2 + syntax_errors: 4 + indentation_errors: 0 + exhausted_context_windows: 0 + test_timeouts: 0 + command: "aider --model ollama/qwen2.5-coder:32b-instruct-fp16 # num_ctx: 2048" + date: 2024-11-26 + versions: 0.64.2.dev,0.65.1.dev + seconds_per_case: 188.6 + total_cost: 0.0000 \ No newline at end of file diff --git a/aider/website/_posts/2024-11-21-quantization.md b/aider/website/_posts/2024-11-21-quantization.md index 303e01b9e..a26538c72 100644 --- a/aider/website/_posts/2024-11-21-quantization.md +++ b/aider/website/_posts/2024-11-21-quantization.md @@ -30,26 +30,29 @@ served both locally and from a variety of cloud providers. - Results from individual providers served via OpenRouter and directly to their own APIs. - Ollama locally serving different quantizations from the [Ollama model library](https://ollama.com/library/qwen2.5-coder:32b-instruct-q4_K_M). -The best versions of the model rival GPT-4o, while the worst performer -is more like the older GPT-4 Turbo. -Suboptimal choices in quantization and token limits can -easily produce far worse results. - This benchmarking effort highlighted a number of pitfalls and details which can have a significant impact on the model's ability to correctly edit code: -- Quantization -- Open source models are often available at dozens of different quantizations. -- Context window -- Cloud providers can decide how large a context window to accept, +- **Quantization** -- Open source models are often available at dozens of different quantizations. +- **Context window** -- Cloud providers can decide how large a context window to accept, and they often choose differently. Ollama defaults to a tiny 2k context window, -and silently discards data that exceeds it. -- Output token limits -- Open source models are often served with wildly +and silently discards data that exceeds it. Such a small window has +catastrophic effects on performance. +- **Output token limits** -- Open source models are often served with wildly differing output token limits. This has a direct impact on how much code the model can write or edit in a response. -- Buggy cloud providers -- Between Qwen and DeepSeep, there were +- **Buggy cloud providers** -- Between Qwen 2.5 Coder 32B Instruct +and DeepSeek V2.5, there were multiple cloud providers with broken or buggy API endpoints that seemed to be returning result different from expected based on the advertised quantization and context sizes. +The best versions of the model rival GPT-4o, while the worst performing +quantization is more like the older GPT-4 Turbo. +Even an excellent fp16 quantization falls to GPT-3.5 Turbo levels of performance +if run with Ollama's default 2k context window. + + ### Sections {: .no_toc } @@ -134,9 +137,10 @@ a request that exceeds the context window. Instead, it just silently truncates the request by discarding the "oldest" messages in the chat to make it fit within the context window. -All of the Ollama results above were collected with at least an 8k context window, which -is large enough to attempt all the coding problems in the benchmark. -Aider sets Ollama's context window to 8k by default. +Except for the single 2k context result, +all of the Ollama results above were collected with at least an 8k context window. +An 8k window is large enough to attempt all the coding problems in the benchmark. +Aider sets Ollama's context window to 8k by default, starting in aider v0.65.0. You can change the Ollama server's context window with a [`.aider.model.settings.yml` file](https://aider.chat/docs/config/adv-model-settings.html#model-settings) From ab3b50296cea708b5e5b5faccbaf20089a4caa97 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 26 Nov 2024 14:12:16 -0800 Subject: [PATCH 08/13] copy --- aider/website/_posts/2024-11-21-quantization.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/aider/website/_posts/2024-11-21-quantization.md b/aider/website/_posts/2024-11-21-quantization.md index a26538c72..a1d060edd 100644 --- a/aider/website/_posts/2024-11-21-quantization.md +++ b/aider/website/_posts/2024-11-21-quantization.md @@ -34,6 +34,8 @@ This benchmarking effort highlighted a number of pitfalls and details which can have a significant impact on the model's ability to correctly edit code: - **Quantization** -- Open source models are often available at dozens of different quantizations. +Most seem to only modestly decrease code editing skill, but stronger quantizations +do have a real impact. - **Context window** -- Cloud providers can decide how large a context window to accept, and they often choose differently. Ollama defaults to a tiny 2k context window, and silently discards data that exceeds it. Such a small window has @@ -43,9 +45,12 @@ differing output token limits. This has a direct impact on how much code the model can write or edit in a response. - **Buggy cloud providers** -- Between Qwen 2.5 Coder 32B Instruct and DeepSeek V2.5, there were -multiple cloud providers with broken or buggy API endpoints that seemed +multiple cloud providers with broken or buggy API endpoints. +They seemed to be returning result different from expected based on the advertised quantization and context sizes. +The harm caused to the code editing benchmark varied from serious +to catastrophic. The best versions of the model rival GPT-4o, while the worst performing quantization is more like the older GPT-4 Turbo. From 476acc7715cf91ca1f3e4112ba6b894d54ee7fe5 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 26 Nov 2024 14:23:18 -0800 Subject: [PATCH 09/13] copy --- aider/website/docs/scripting.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/website/docs/scripting.md b/aider/website/docs/scripting.md index df9533af0..32d060f25 100644 --- a/aider/website/docs/scripting.md +++ b/aider/website/docs/scripting.md @@ -96,5 +96,5 @@ coder = Coder.create(model=model, fnames=fnames, io=io) ``` {: .note } -The scripting API is not officially supported or documented and may -change without warning. +The python scripting API is not officially supported or documented, +and could change in future releases without providing backwards compatibility. From 2e7c5d6cfaafe0026c47bb4d6a499acd7bfa3ee6 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 26 Nov 2024 15:00:33 -0800 Subject: [PATCH 10/13] fix: handle permission error when writing to .gitignore --- aider/main.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/aider/main.py b/aider/main.py index ac5eb19e7..f36ab7272 100644 --- a/aider/main.py +++ b/aider/main.py @@ -177,9 +177,15 @@ def check_gitignore(git_root, io, ask=True): if content and not content.endswith("\n"): content += "\n" content += "\n".join(patterns_to_add) + "\n" - io.write_text(gitignore_file, content) - - io.tool_output(f"Added {', '.join(patterns_to_add)} to .gitignore") + + try: + io.write_text(gitignore_file, content) + io.tool_output(f"Added {', '.join(patterns_to_add)} to .gitignore") + except PermissionError: + io.tool_error(f"Permission denied when trying to write to {gitignore_file}") + io.tool_output("Try running with appropriate permissions or manually add these patterns to .gitignore:") + for pattern in patterns_to_add: + io.tool_output(f" {pattern}") def check_streamlit_install(io): From f45533e20bca39529267cf060a42cde88814c14f Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 26 Nov 2024 15:00:38 -0800 Subject: [PATCH 11/13] style: fix line length and whitespace in gitignore handling --- aider/main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/aider/main.py b/aider/main.py index f36ab7272..6391ee619 100644 --- a/aider/main.py +++ b/aider/main.py @@ -177,13 +177,15 @@ def check_gitignore(git_root, io, ask=True): if content and not content.endswith("\n"): content += "\n" content += "\n".join(patterns_to_add) + "\n" - + try: io.write_text(gitignore_file, content) io.tool_output(f"Added {', '.join(patterns_to_add)} to .gitignore") except PermissionError: io.tool_error(f"Permission denied when trying to write to {gitignore_file}") - io.tool_output("Try running with appropriate permissions or manually add these patterns to .gitignore:") + io.tool_output( + "Try running with appropriate permissions or manually add these patterns to .gitignore:" + ) for pattern in patterns_to_add: io.tool_output(f" {pattern}") From 3ba4aca2688d835ec58d5ab2a46dc4c462047555 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 26 Nov 2024 15:01:50 -0800 Subject: [PATCH 12/13] refactor: improve error handling for .gitignore file operations --- aider/main.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/aider/main.py b/aider/main.py index 6391ee619..29c6a9efb 100644 --- a/aider/main.py +++ b/aider/main.py @@ -157,13 +157,17 @@ def check_gitignore(git_root, io, ask=True): gitignore_file = Path(git_root) / ".gitignore" if gitignore_file.exists(): - content = io.read_text(gitignore_file) - if content is None: + try: + content = io.read_text(gitignore_file) + if content is None: + return + existing_lines = content.splitlines() + for pat in patterns: + if pat not in existing_lines: + patterns_to_add.append(pat) + except OSError as e: + io.tool_error(f"Error when trying to read {gitignore_file}: {e}") return - existing_lines = content.splitlines() - for pat in patterns: - if pat not in existing_lines: - patterns_to_add.append(pat) else: content = "" patterns_to_add = patterns @@ -181,8 +185,8 @@ def check_gitignore(git_root, io, ask=True): try: io.write_text(gitignore_file, content) io.tool_output(f"Added {', '.join(patterns_to_add)} to .gitignore") - except PermissionError: - io.tool_error(f"Permission denied when trying to write to {gitignore_file}") + except OSError as e: + io.tool_error(f"Error when trying to write to {gitignore_file}: {e}") io.tool_output( "Try running with appropriate permissions or manually add these patterns to .gitignore:" ) From b2232cda7b097e902044dbe08c5570cddda08f82 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 26 Nov 2024 15:04:19 -0800 Subject: [PATCH 13/13] refactor: modify check_for_urls to return modified input string --- aider/coders/base_coder.py | 8 +++----- tests/basic/test_coder.py | 7 ++++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/aider/coders/base_coder.py b/aider/coders/base_coder.py index b350b7e90..1e0e8048b 100755 --- a/aider/coders/base_coder.py +++ b/aider/coders/base_coder.py @@ -784,7 +784,7 @@ class Coder: return self.commands.run(inp) self.check_for_file_mentions(inp) - self.check_for_urls(inp) + inp = self.check_for_urls(inp) return inp @@ -830,11 +830,10 @@ class Coder: def check_for_urls(self, inp: str) -> List[str]: """Check input for URLs and offer to add them to the chat.""" if not self.detect_urls: - return [] + return inp url_pattern = re.compile(r"(https?://[^\s/$.?#].[^\s]*[^\s,.])") urls = list(set(url_pattern.findall(inp))) # Use set to remove duplicates - added_urls = [] group = ConfirmGroup(urls) for url in urls: if url not in self.rejected_urls: @@ -844,11 +843,10 @@ class Coder: ): inp += "\n\n" inp += self.commands.cmd_web(url, return_content=True) - added_urls.append(url) else: self.rejected_urls.add(url) - return added_urls + return inp def keyboard_interrupt(self): now = time.time() diff --git a/tests/basic/test_coder.py b/tests/basic/test_coder.py index f04e6671e..88026cfb0 100644 --- a/tests/basic/test_coder.py +++ b/tests/basic/test_coder.py @@ -771,7 +771,7 @@ two # Test case with no URL no_url_input = "This text contains no URL" result = coder.check_for_urls(no_url_input) - self.assertEqual(result, []) + self.assertEqual(result, no_url_input) # Test case with the same URL appearing multiple times repeated_url_input = ( @@ -779,7 +779,8 @@ two " more time" ) result = coder.check_for_urls(repeated_url_input) - self.assertEqual(result.count("https://example.com"), 1) + # the original 3 in the input text, plus 1 more for the scraped text + self.assertEqual(result.count("https://example.com"), 4) self.assertIn("https://example.com", result) def test_coder_from_coder_with_subdir(self): @@ -877,7 +878,7 @@ This command will print 'Hello, World!' to the console.""" # Test with a message containing a URL message = "Check out https://example.com" result = coder.check_for_urls(message) - self.assertEqual(result, []) + self.assertEqual(result, message) coder.commands.scraper.scrape.assert_not_called() def test_unknown_edit_format_exception(self):