mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 08:44:59 +00:00
refac
This commit is contained in:
parent
9d821dbca6
commit
cdfc0a38ee
1 changed files with 15 additions and 3 deletions
|
@ -14,11 +14,12 @@ from rich.console import Console
|
||||||
from rich.live import Live
|
from rich.live import Live
|
||||||
from rich.markdown import Markdown
|
from rich.markdown import Markdown
|
||||||
|
|
||||||
# from aider.dump import dump
|
|
||||||
from aider import prompts, utils
|
from aider import prompts, utils
|
||||||
from aider.commands import Commands
|
from aider.commands import Commands
|
||||||
from aider.repomap import RepoMap
|
from aider.repomap import RepoMap
|
||||||
|
|
||||||
|
from .dump import dump
|
||||||
|
|
||||||
|
|
||||||
class MissingAPIKeyError(ValueError):
|
class MissingAPIKeyError(ValueError):
|
||||||
pass
|
pass
|
||||||
|
@ -468,7 +469,11 @@ class Coder:
|
||||||
if live:
|
if live:
|
||||||
live.stop()
|
live.stop()
|
||||||
|
|
||||||
def update_files(self, content):
|
def update_files_gpt35(self, content):
|
||||||
|
dump(content)
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update_files_gpt4(self, content):
|
||||||
# might raise ValueError for malformed ORIG/UPD blocks
|
# might raise ValueError for malformed ORIG/UPD blocks
|
||||||
edits = list(utils.find_original_update_blocks(content))
|
edits = list(utils.find_original_update_blocks(content))
|
||||||
|
|
||||||
|
@ -676,8 +681,15 @@ class Coder:
|
||||||
return set(self.get_all_relative_files()) - set(self.get_inchat_relative_files())
|
return set(self.get_all_relative_files()) - set(self.get_inchat_relative_files())
|
||||||
|
|
||||||
def apply_updates(self, content):
|
def apply_updates(self, content):
|
||||||
|
if self.main_model == "gpt-4":
|
||||||
|
method = self.update_files_gpt4
|
||||||
|
elif self.main_model == "gpt-3.5-turbo":
|
||||||
|
method = self.update_files_gpt35
|
||||||
|
else:
|
||||||
|
raise ValueError(f"apply_updates() doesn't support {self.main_model}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
edited = self.update_files(content)
|
edited = method(content)
|
||||||
return edited, None
|
return edited, None
|
||||||
except ValueError as err:
|
except ValueError as err:
|
||||||
err = err.args[0]
|
err = err.args[0]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue