| 4 | |
| 5 | |
| 6 | class ArchitectCoder(AskCoder): |
| 7 | edit_format = "architect" |
| 8 | gpt_prompts = ArchitectPrompts() |
| 9 | auto_accept_architect = False |
| 10 | |
| 11 | def reply_completed(self): |
| 12 | content = self.partial_response_content |
| 13 | |
| 14 | if not content or not content.strip(): |
| 15 | return |
| 16 | |
| 17 | if not self.auto_accept_architect and not self.io.confirm_ask("Edit the files?"): |
| 18 | return |
| 19 | |
| 20 | kwargs = dict() |
| 21 | |
| 22 | # Use the editor_model from the main_model if it exists, otherwise use the main_model itself |
| 23 | editor_model = self.main_model.editor_model or self.main_model |
| 24 | |
| 25 | kwargs["main_model"] = editor_model |
| 26 | kwargs["edit_format"] = self.main_model.editor_edit_format |
| 27 | kwargs["suggest_shell_commands"] = False |
| 28 | kwargs["map_tokens"] = 0 |
| 29 | kwargs["total_cost"] = self.total_cost |
| 30 | kwargs["cache_prompts"] = False |
| 31 | kwargs["num_cache_warming_pings"] = 0 |
| 32 | kwargs["summarize_from_coder"] = False |
| 33 | |
| 34 | new_kwargs = dict(io=self.io, from_coder=self) |
| 35 | new_kwargs.update(kwargs) |
| 36 | |
| 37 | editor_coder = Coder.create(**new_kwargs) |
| 38 | editor_coder.cur_messages = [] |
| 39 | editor_coder.done_messages = [] |
| 40 | |
| 41 | if self.verbose: |
| 42 | editor_coder.show_announcements() |
| 43 | |
| 44 | editor_coder.run(with_message=content, preproc=False) |
| 45 | |
| 46 | self.move_back_cur_messages("I made those changes to the files.") |
| 47 | self.total_cost = editor_coder.total_cost |
| 48 | self.aider_commit_hashes = editor_coder.aider_commit_hashes |